home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / system16.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  423KB  |  11,878 lines

  1. /*
  2.  
  3.  
  4. --------
  5.   ASTORMBL
  6.           3. In the ending, the 3 heroes are floating into a half bubble. (see picture). Also colour problems during ending as well.
  7.           4. In the later Shooting gallery stage (like inside the car shop and the factory (mission 3)),
  8.           there is some garbage graphics (sprite of death monsters that appear where they should not)
  9.  
  10.  
  11.     working:
  12.         Alex Kidd
  13.         Alien Storm (bootleg)
  14.         Alien Syndrome
  15.         Altered Beast (Ver 1)
  16.         Altered Beast (Ver 2)    (No Sound)
  17.         Atomic Point            (No Sound)
  18.         Aurail                    (Speech quality sounds poor)
  19.         Aurail (317-0168)
  20.         Bay Route
  21.         Body Slam
  22.         Dump Matsumoto (Japan, Body Slam)
  23.         Dynamite Dux (bootleg)
  24.         Enduro Racer (bootleg)
  25.         Enduro Racer (custom bootleg)
  26.         E-Swat (bootleg)
  27.         Fantasy Zone (Old Ver.)
  28.         Fantasy Zone (New Ver.)
  29.         Flash Point  (bootleg)
  30.         Golden Axe (Ver 1)
  31.         Golden Axe (Ver 2)
  32.         Hang-on
  33.         Heavyweight Champ: some minor graphics glitches
  34.         Major League: No game over.
  35.         Moonwalker (bootleg): Music Speed varies
  36.         Outrun (set 1)
  37.         Outrun (set 2)
  38.         Outrun (custom bootleg)
  39.         Passing Shot (bootleg)
  40.         Passing Shot (4 player bootleg)
  41.         Quartet: Glitch on highscore list
  42.         Quartet (Japan): Glitch on highscore list
  43.         Quartet 2: Glitch on highscore list
  44.         Riot City
  45.         SDI
  46.         Shadow Dancer
  47.         Shadow Dancer (Japan)
  48.         Shinobi
  49.         Shinobi (Sys16A Bootleg?)
  50.         Space Harrier
  51.         Super Hangon (bootleg)
  52.         Tetris (bootleg)
  53.         Time Scanner
  54.         Toryumon
  55.         Tough Turf (Japan)            (No Sound)
  56.         Tough Turf (US)                (No Sound)
  57.         Tough Turf (bootleg)    (No Speech Roms)
  58.         Wonderboy 3 - Monster Lair
  59.         Wonderboy 3 - Monster Lair (bootleg)
  60.         Wrestle War
  61.  
  62.     not really working:
  63.         Shadow Dancer (bootleg)
  64.  
  65.     protected:
  66.         Alex Kidd (jpn?)
  67.         Alien Syndrome
  68.         Alien Syndrome
  69.         Alien Syndrome (Japan)
  70.         Alien Storm
  71.         Alien Storm (2 Player)
  72.         Bay Route (317-0116)
  73.         Bay Route (protected bootleg 1)
  74.         Bay Route (protected bootleg 2)
  75.         Enduro Racer
  76.         E-Swat
  77.         Flash Point
  78.         Golden Axe (Ver 1 317-0121 Japan)
  79.         Golden Axe (Ver 2 317-0110)
  80.         Golden Axe (Ver 2 317-0122)
  81.         Golden Axe (protected bootleg)
  82.         Jyuohki (Japan, altered beast)
  83.         Moonwalker (317-0158)
  84.         Moonwalker (317-0159)
  85.         Passing Shot (317-0080)
  86.         Shinobi (Sys16B 317-0049)
  87.         Shinobi (Sys16A 317-0050)
  88.         SDI (Japan, old version)
  89.         Super Hangon
  90.         Tetris (Type A)
  91.         Tetris (Type B 317-0092)
  92.         Wonderboy 3 - Monster Lair (317-0089)
  93.  
  94.     protected (No driver):
  95.         Ace Attacker
  96.         Action Fighter
  97.         Bloxeed
  98.         Clutch Hitter
  99.         Cotton (Japan)
  100.         Cotton
  101.         DD Crew
  102.         Dunk Shot
  103.         Excite League
  104.         Laser Ghost
  105.         Line of Fire
  106.         MVP
  107.         Ryukyu
  108.         Super Leagu
  109.         Thunder Blade
  110.         Thunder Blade (Japan)
  111.         Turbo Outrun
  112.         Turbo Outrun (Set 2)
  113.  
  114.     not working (No driver):
  115.         After Burner
  116.         After Burner II
  117.  
  118. */
  119.  
  120. #define SYS16_CREDITS \
  121.     "Thierry Lescot & Nao (Hardware Info)\n" \
  122.     "Mirko Buffoni (MAME driver)\n" \
  123.     "Andrew Prime\n" \
  124.     "Phil Stroffolino"
  125.  
  126.  
  127. //#define SPACEHARRIER_OFFSETS
  128.  
  129.  
  130. /*
  131. This should be enabled when the sprite manager fully handles the special
  132. left/right side markers. This will fix graphics glitches in several games,
  133. including ESwat, Alien Storm and Altered Beast.
  134. */
  135. #define SPRITE_SIDE_MARKERS
  136. #define TRANSPARENT_SHADOWS
  137.  
  138. #ifdef TRANSPARENT_SHADOWS
  139. #define NumOfShadowColors 32
  140. #define ShadowColorsMultiplier 2
  141. extern int sys16_sh_shadowpal;
  142. #else
  143. #define ShadowColorsMultiplier 1
  144. #endif
  145. extern int sys16_MaxShadowColors;
  146.  
  147. #include "driver.h"
  148. #include "vidhrdw/generic.h"
  149. #include "cpu/z80/z80.h"
  150. #include "cpu/i8039/i8039.h"
  151.  
  152. /***************************************************************************/
  153.  
  154. READ_HANDLER( sys16_tileram_r );
  155. WRITE_HANDLER( sys16_tileram_w );
  156. READ_HANDLER( sys16_textram_r );
  157. WRITE_HANDLER( sys16_textram_w );
  158. extern int sys16_vh_start( void );
  159. extern void sys16_vh_stop( void );
  160. extern void sys16_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  161. WRITE_HANDLER( sys16_paletteram_w );
  162.  
  163. extern int sys16_ho_vh_start( void );
  164. extern void sys16_ho_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  165.  
  166. extern int sys16_or_vh_start( void );
  167. extern void sys16_or_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  168.  
  169. extern int sys18_vh_start( void );
  170. extern void sys18_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  171.  
  172. /* video driver constants (vary with game) */
  173. extern int sys16_spritesystem;
  174. extern int sys16_sprxoffset;
  175. extern int sys16_bgxoffset;
  176. extern int sys16_fgxoffset;
  177. extern int *sys16_obj_bank;
  178. extern int sys16_textmode;
  179. extern int sys16_textlayer_lo_min;
  180. extern int sys16_textlayer_lo_max;
  181. extern int sys16_textlayer_hi_min;
  182. extern int sys16_textlayer_hi_max;
  183. extern int sys16_dactype;
  184. extern int sys16_bg1_trans;
  185. extern int sys16_bg_priority_mode;
  186. extern int sys16_fg_priority_mode;
  187. extern int sys16_bg_priority_value;
  188. extern int sys16_fg_priority_value;
  189. extern int sys16_spritelist_end;
  190. extern int sys16_tilebank_switch;
  191. extern int sys16_rowscroll_scroll;
  192. extern int sys16_quartet_title_kludge;
  193. void (* sys16_update_proc)( void );
  194.  
  195. /* video driver registers */
  196. extern int sys16_refreshenable;
  197. extern int sys16_clear_screen;
  198. extern int sys16_tile_bank0;
  199. extern int sys16_tile_bank1;
  200. extern int sys16_bg_scrollx, sys16_bg_scrolly;
  201. extern int sys16_bg_page[4];
  202. extern int sys16_fg_scrollx, sys16_fg_scrolly;
  203. extern int sys16_fg_page[4];
  204.  
  205. extern int sys16_bg2_scrollx, sys16_bg2_scrolly;
  206. extern int sys16_bg2_page[4];
  207. extern int sys16_fg2_scrollx, sys16_fg2_scrolly;
  208. extern int sys16_fg2_page[4];
  209.  
  210. extern int sys18_bg2_active;
  211. extern int sys18_fg2_active;
  212. extern unsigned char *sys18_splittab_bg_x;
  213. extern unsigned char *sys18_splittab_bg_y;
  214. extern unsigned char *sys18_splittab_fg_x;
  215. extern unsigned char *sys18_splittab_fg_y;
  216.  
  217. #ifdef SPACEHARRIER_OFFSETS
  218. extern unsigned char *spaceharrier_patternoffsets;
  219. #endif
  220. extern unsigned char *gr_ver;
  221. extern unsigned char *gr_hor;
  222. extern unsigned char *gr_pal;
  223. extern unsigned char *gr_flip;
  224. extern int gr_palette;
  225. extern int gr_palette_default;
  226. extern unsigned char gr_colorflip[2][4];
  227. extern unsigned char *gr_second_road;
  228.  
  229. /* video driver has access to these memory regions */
  230. unsigned char *sys16_tileram;
  231. unsigned char *sys16_textram;
  232. unsigned char *sys16_spriteram;
  233.  
  234. /* other memory regions */
  235. static unsigned char *sys16_workingram;
  236. static unsigned char *sys16_extraram;
  237. static unsigned char *sys16_extraram2;
  238. static unsigned char *sys16_extraram3;
  239. static unsigned char *sys16_extraram4;
  240. static unsigned char *sys16_extraram5;
  241.  
  242. // 7751 emulation
  243. WRITE_HANDLER( sys16_7751_audio_8255_w );
  244.  READ_HANDLER( sys16_7751_audio_8255_r );
  245.  READ_HANDLER( sys16_7751_sh_rom_r );
  246.  READ_HANDLER( sys16_7751_sh_t1_r );
  247.  READ_HANDLER( sys16_7751_sh_command_r );
  248. WRITE_HANDLER( sys16_7751_sh_dac_w );
  249. WRITE_HANDLER( sys16_7751_sh_busy_w );
  250. WRITE_HANDLER( sys16_7751_sh_offset_a0_a3_w );
  251. WRITE_HANDLER( sys16_7751_sh_offset_a4_a7_w );
  252. WRITE_HANDLER( sys16_7751_sh_offset_a8_a11_w );
  253. WRITE_HANDLER( sys16_7751_sh_rom_select_w );
  254.  
  255.  
  256. // encryption decoding
  257. void endurob2_decode_data(unsigned char *dest,unsigned char *source,int size);
  258. void endurob2_decode_data2(unsigned char *dest,unsigned char *source,int size);
  259. void enduror_decode_data(unsigned char *dest,unsigned char *source,int size);
  260. void enduror_decode_data2(unsigned char *dest,unsigned char *source,int size);
  261.  
  262. void aurail_decode_data(unsigned char *dest,unsigned char *source,int size);
  263. void aurail_decode_opcode1(unsigned char *dest,unsigned char *source,int size);
  264. void aurail_decode_opcode2(unsigned char *dest,unsigned char *source,int size);
  265.  
  266. /***************************************************************************/
  267.  
  268. #define MWA_PALETTERAM    sys16_paletteram_w, &paletteram
  269. #define MRA_PALETTERAM    paletteram_word_r
  270.  
  271. #define MRA_WORKINGRAM    MRA_BANK1
  272. #define MWA_WORKINGRAM    MWA_BANK1,&sys16_workingram
  273.  
  274. #define MRA_SPRITERAM    MRA_BANK2
  275. #define MWA_SPRITERAM    MWA_BANK2,&sys16_spriteram
  276.  
  277. #define MRA_TILERAM        sys16_tileram_r
  278. #define MWA_TILERAM        sys16_tileram_w,&sys16_tileram
  279.  
  280. #define MRA_TEXTRAM        sys16_textram_r
  281. #define MWA_TEXTRAM        sys16_textram_w,&sys16_textram
  282.  
  283. #define MRA_EXTRAM        MRA_BANK3
  284. #define MWA_EXTRAM        MWA_BANK3,&sys16_extraram
  285.  
  286. #define MRA_EXTRAM2        MRA_BANK4
  287. #define MWA_EXTRAM2        MWA_BANK4,&sys16_extraram2
  288.  
  289. #define MRA_EXTRAM3        MRA_BANK5
  290. #define MWA_EXTRAM3        MWA_BANK5,&sys16_extraram3
  291.  
  292. #define MRA_EXTRAM4        MRA_BANK6
  293. #define MWA_EXTRAM4        MWA_BANK6,&sys16_extraram4
  294.  
  295. #define MRA_EXTRAM5        MRA_BANK7
  296. #define MWA_EXTRAM5        MWA_BANK7,&sys16_extraram5
  297.  
  298. /***************************************************************************/
  299.  
  300. #define MACHINE_DRIVER( GAMENAME,READMEM,WRITEMEM,INITMACHINE,GFXSIZE) \
  301. static struct MachineDriver GAMENAME = \
  302. { \
  303.     { \
  304.         { \
  305.             CPU_M68000, \
  306.             10000000, \
  307.             READMEM,WRITEMEM,0,0, \
  308.             sys16_interrupt,1 \
  309.         }, \
  310.         { \
  311.             CPU_Z80 | CPU_AUDIO_CPU, \
  312.             4096000, \
  313.             sound_readmem,sound_writemem,sound_readport,sound_writeport, \
  314.             ignore_interrupt,1 \
  315.         }, \
  316.     }, \
  317.     60, DEFAULT_60HZ_VBLANK_DURATION, \
  318.     1, \
  319.     INITMACHINE, \
  320.     40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 }, \
  321.     GFXSIZE, \
  322.     2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier, \
  323.     0, \
  324.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE, \
  325.     0, \
  326.     sys16_vh_start, \
  327.     sys16_vh_stop, \
  328.     sys16_vh_screenrefresh, \
  329.     SOUND_SUPPORTS_STEREO,0,0,0, \
  330.     { \
  331.         { \
  332.             SOUND_YM2151, \
  333.             &ym2151_interface \
  334.         } \
  335.     } \
  336. };
  337.  
  338. #define MACHINE_DRIVER_7759( GAMENAME,READMEM,WRITEMEM,INITMACHINE,GFXSIZE, UPD7759INTF ) \
  339. static struct MachineDriver GAMENAME = \
  340. { \
  341.     { \
  342.         { \
  343.             CPU_M68000, \
  344.             10000000, \
  345.             READMEM,WRITEMEM,0,0, \
  346.             sys16_interrupt,1 \
  347.         }, \
  348.         { \
  349.             CPU_Z80 | CPU_AUDIO_CPU, \
  350.             4096000, \
  351.             sound_readmem_7759,sound_writemem,sound_readport,sound_writeport_7759, \
  352.             ignore_interrupt,1 \
  353.         }, \
  354.     }, \
  355.     60, DEFAULT_60HZ_VBLANK_DURATION, \
  356.     1, \
  357.     INITMACHINE, \
  358.     40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 }, \
  359.     GFXSIZE, \
  360.     2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier, \
  361.     0, \
  362.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE, \
  363.     0, \
  364.     sys16_vh_start, \
  365.     sys16_vh_stop, \
  366.     sys16_vh_screenrefresh, \
  367.     SOUND_SUPPORTS_STEREO,0,0,0, \
  368.     { \
  369.         { \
  370.             SOUND_YM2151, \
  371.             &ym2151_interface \
  372.         }, { \
  373.             SOUND_UPD7759, \
  374.             &UPD7759INTF \
  375.         } \
  376.     } \
  377. };
  378.  
  379.  
  380. #define MACHINE_DRIVER_7751( GAMENAME,READMEM,WRITEMEM,INITMACHINE,GFXSIZE ) \
  381. static struct MachineDriver GAMENAME = \
  382. { \
  383.     { \
  384.         { \
  385.             CPU_M68000, \
  386.             10000000, \
  387.             READMEM,WRITEMEM,0,0, \
  388.             sys16_interrupt,1 \
  389.         }, \
  390.         { \
  391.             CPU_Z80 | CPU_AUDIO_CPU, \
  392.             4096000, \
  393.             sound_readmem_7751,sound_writemem,sound_readport_7751,sound_writeport_7751, \
  394.             ignore_interrupt,1 \
  395.         }, \
  396.         { \
  397.             CPU_N7751 | CPU_AUDIO_CPU, \
  398.             6000000/15,        /* 6Mhz crystal */ \
  399.             readmem_7751,writemem_7751,readport_7751,writeport_7751, \
  400.             ignore_interrupt,1 \
  401.         } \
  402.     }, \
  403.     60, DEFAULT_60HZ_VBLANK_DURATION, \
  404.     1, \
  405.     INITMACHINE, \
  406.     40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 }, \
  407.     GFXSIZE, \
  408.     2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier, \
  409.     0, \
  410.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE, \
  411.     0, \
  412.     sys16_vh_start, \
  413.     sys16_vh_stop, \
  414.     sys16_vh_screenrefresh, \
  415.     SOUND_SUPPORTS_STEREO,0,0,0, \
  416.     { \
  417.         { \
  418.             SOUND_YM2151, \
  419.             &ym2151_interface \
  420.         }, \
  421.         { \
  422.             SOUND_DAC, \
  423.             &sys16_7751_dac_interface \
  424.         } \
  425.     } \
  426. };
  427.  
  428.  
  429. #define MACHINE_DRIVER_18( GAMENAME,READMEM,WRITEMEM,INITMACHINE,GFXSIZE) \
  430. static struct MachineDriver GAMENAME = \
  431. { \
  432.     { \
  433.         { \
  434.             CPU_M68000, \
  435.             10000000, \
  436.             READMEM,WRITEMEM,0,0, \
  437.             sys16_interrupt,1 \
  438.         }, \
  439.         { \
  440.             CPU_Z80 | CPU_AUDIO_CPU, \
  441.             4096000*2, /* overclocked to fix sound, but wrong! */ \
  442.             sound_readmem_18,sound_writemem_18,sound_readport_18,sound_writeport_18, \
  443.             ignore_interrupt,1 \
  444.         }, \
  445.     }, \
  446.     60, DEFAULT_60HZ_VBLANK_DURATION, \
  447.     1, \
  448.     INITMACHINE, \
  449.     40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 }, \
  450.     GFXSIZE, \
  451.     2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier, \
  452.     0, \
  453.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE, \
  454.     0, \
  455.     sys18_vh_start, \
  456.     sys16_vh_stop, \
  457.     sys18_vh_screenrefresh, \
  458.     SOUND_SUPPORTS_STEREO,0,0,0, \
  459.     { \
  460.         { \
  461.             SOUND_YM3438, \
  462.             &ym3438_interface \
  463.         }, \
  464.         { \
  465.             SOUND_RF5C68, \
  466.             &rf5c68_interface, \
  467.         } \
  468.     } \
  469. };
  470.  
  471.  
  472.  
  473. static void (*sys16_custom_irq)(void);
  474.  
  475. static void sys16_onetime_init_machine(void)
  476. {
  477.     sys16_bg1_trans=0;
  478.     sys16_rowscroll_scroll=0;
  479.     sys18_splittab_bg_x=0;
  480.     sys18_splittab_bg_y=0;
  481.     sys18_splittab_fg_x=0;
  482.     sys18_splittab_fg_y=0;
  483.  
  484.     sys16_quartet_title_kludge=0;
  485.  
  486.     sys16_custom_irq=NULL;
  487.  
  488.     sys16_MaxShadowColors=NumOfShadowColors;
  489.  
  490. #ifdef SPACEHARRIER_OFFSETS
  491.     spaceharrier_patternoffsets=0;
  492. #endif
  493. }
  494.  
  495. /***************************************************************************/
  496.  
  497. int sys16_interrupt( void ){
  498.     if(sys16_custom_irq) sys16_custom_irq();
  499.     return 4; /* Interrupt vector 4, used by VBlank */
  500. }
  501.  
  502. /***************************************************************************/
  503.  
  504. static void sound_cause_nmi(int chip)
  505. {
  506.     cpu_set_nmi_line(1, PULSE_LINE);
  507. }
  508.  
  509. static struct MemoryReadAddress sound_readmem[] =
  510. {
  511.     { 0x0000, 0x7fff, MRA_ROM },
  512.     { 0xe800, 0xe800, soundlatch_r },
  513.     { 0xf800, 0xffff, MRA_RAM },
  514.     { -1 }  /* end of table */
  515. };
  516.  
  517. static struct MemoryWriteAddress sound_writemem[] =
  518. {
  519.     { 0x0000, 0x7fff, MWA_ROM },
  520.     { 0xf800, 0xffff, MWA_RAM },
  521.     { -1 }  /* end of table */
  522. };
  523.  
  524. static struct IOReadPort sound_readport[] =
  525. {
  526.     { 0x01, 0x01, YM2151_status_port_0_r },
  527.     { 0xc0, 0xc0, soundlatch_r },
  528.     { -1 }    /* end of table */
  529. };
  530.  
  531. static struct IOWritePort sound_writeport[] =
  532. {
  533.     { 0x00, 0x00, YM2151_register_port_0_w },
  534.     { 0x01, 0x01, YM2151_data_port_0_w },
  535.     { -1 }
  536. };
  537.  
  538.  
  539.  
  540. // 7751 Sound
  541.  
  542. static struct MemoryReadAddress sound_readmem_7751[] =
  543. {
  544.     { 0x0000, 0x7fff, MRA_ROM },
  545.     { 0xe800, 0xe800, soundlatch_r },
  546.     { 0xf800, 0xffff, MRA_RAM },
  547.     { -1 }  /* end of table */
  548. };
  549.  
  550. static struct IOReadPort sound_readport_7751[] =
  551. {
  552.     { 0x01, 0x01, YM2151_status_port_0_r },
  553. //    { 0x0e, 0x0e, sys16_7751_audio_8255_r },
  554.     { 0xc0, 0xc0, soundlatch_r },
  555.     { -1 }    /* end of table */
  556. };
  557.  
  558.  
  559.  
  560. static struct IOWritePort sound_writeport_7751[] =
  561. {
  562.     { 0x00, 0x00, YM2151_register_port_0_w },
  563.     { 0x01, 0x01, YM2151_data_port_0_w },
  564.     { 0x80, 0x80, sys16_7751_audio_8255_w },
  565.     { -1 }
  566. };
  567.  
  568. static struct MemoryReadAddress readmem_7751[] =
  569. {
  570.         { 0x0000, 0x03ff, MRA_ROM },
  571.         { -1 }  /* end of table */
  572. };
  573.  
  574. static struct MemoryWriteAddress writemem_7751[] =
  575. {
  576.         { 0x0000, 0x03ff, MWA_ROM },
  577.         { -1 }  /* end of table */
  578. };
  579.  
  580. static struct IOReadPort readport_7751[] =
  581. {
  582.         { I8039_t1,  I8039_t1,  sys16_7751_sh_t1_r },
  583.         { I8039_p2,  I8039_p2,  sys16_7751_sh_command_r },
  584.         { I8039_bus, I8039_bus, sys16_7751_sh_rom_r },
  585.         { -1 }  /* end of table */
  586. };
  587.  
  588. static struct IOWritePort writeport_7751[] =
  589. {
  590.         { I8039_p1, I8039_p1, sys16_7751_sh_dac_w },
  591.         { I8039_p2, I8039_p2, sys16_7751_sh_busy_w },
  592.         { I8039_p4, I8039_p4, sys16_7751_sh_offset_a0_a3_w },
  593.         { I8039_p5, I8039_p5, sys16_7751_sh_offset_a4_a7_w },
  594.         { I8039_p6, I8039_p6, sys16_7751_sh_offset_a8_a11_w },
  595.         { I8039_p7, I8039_p7, sys16_7751_sh_rom_select_w },
  596.         { -1 }  /* end of table */
  597. };
  598.  
  599. static struct DACinterface sys16_7751_dac_interface =
  600. {
  601.         1,
  602.         { 100 }
  603. };
  604.  
  605.  
  606. // 7759
  607.  
  608.  
  609. static struct MemoryReadAddress sound_readmem_7759[] =
  610. {
  611.     { 0x0000, 0x7fff, MRA_ROM },
  612.     { 0x8000, 0xdfff, UPD7759_0_data_r },
  613.     { 0xe800, 0xe800, soundlatch_r },
  614.     { 0xf800, 0xffff, MRA_RAM },
  615.     { -1 }  /* end of table */
  616. };
  617.  
  618. // some games (aurail, riotcity, eswat), seem to send different format data to the 7759
  619. // this function changes that data to what the 7759 expects, but it sounds quite poor.
  620. static WRITE_HANDLER( UPD7759_process_message_w )
  621. {
  622.     if((data & 0xc0) == 0x40) data=0xc0;
  623.     else data&=0x3f;
  624.  
  625.     UPD7759_message_w(offset,data);
  626. }
  627.  
  628. static struct IOWritePort sound_writeport_7759[] =
  629. {
  630.     { 0x00, 0x00, YM2151_register_port_0_w },
  631.     { 0x01, 0x01, YM2151_data_port_0_w },
  632.     { 0x40, 0x40, UPD7759_process_message_w },
  633.     { 0x80, 0x80, UPD7759_0_start_w },
  634.     { -1 }
  635. };
  636.  
  637. static struct UPD7759_interface upd7759_interface =
  638. {
  639.     1,            /* 1 chip */
  640.     UPD7759_STANDARD_CLOCK,
  641.     { 60 },     /* volumes */
  642.     { REGION_CPU2 },            /* memory region 3 contains the sample data */
  643.     UPD7759_SLAVE_MODE,
  644.     { sound_cause_nmi },
  645. };
  646.  
  647. // SYS18 Sound
  648.  
  649. unsigned char *sys18_SoundMemBank;
  650.  
  651. static READ_HANDLER( system18_bank_r )
  652. {
  653.     return sys18_SoundMemBank[offset];
  654. }
  655.  
  656. static struct MemoryReadAddress sound_readmem_18[] =
  657. {
  658.     { 0x0000, 0x9fff, MRA_ROM },
  659.     { 0xa000, 0xbfff, system18_bank_r },
  660.     /**** D/A register ****/
  661.     { 0xd000, 0xdfff, RF5C68_r },
  662.     { 0xe000, 0xffff, MRA_RAM },
  663.     { -1 }  /* end of table */
  664. };
  665.  
  666. static struct MemoryWriteAddress sound_writemem_18[] =
  667. {
  668.     { 0x0000, 0xbfff, MWA_ROM },
  669.     /**** D/A register ****/
  670.     { 0xc000, 0xc008, RF5C68_reg_w },
  671.     { 0xd000, 0xdfff, RF5C68_w },
  672.     { 0xe000, 0xffff, MWA_RAM },    //??
  673.     { -1 }  /* end of table */
  674. };
  675.  
  676. static struct RF5C68interface rf5c68_interface = {
  677.   //3580000 * 2,
  678.   3579545*2,
  679.   100
  680. };
  681.  
  682.  
  683. static WRITE_HANDLER( sys18_soundbank_w )
  684. {
  685. // select access bank for a000~bfff
  686.     unsigned char *RAM = memory_region(REGION_CPU2);
  687.     int Bank=0;
  688.  
  689.     switch (data&0xc0)
  690.     {
  691.         case 0x00:
  692.             Bank = data<<13;
  693.             break;
  694.         case 0x40:
  695.             Bank = ((data&0x1f) + 128/8)<<13;
  696.             break;
  697.         case 0x80:
  698.             Bank = ((data&0x1f) + (256+128)/8)<<13;
  699.             break;
  700.         case 0xc0:
  701.             Bank = ((data&0x1f) + (512+128)/8)<<13;
  702.             break;
  703.     }
  704.     sys18_SoundMemBank = &RAM[Bank+0x10000];
  705. }
  706.  
  707. static struct IOReadPort sound_readport_18[] =
  708. {
  709.     { 0x80, 0x80, YM2612_status_port_0_A_r },
  710. //    { 0x82, 0x82, YM2612_status_port_0_B_r },
  711. //    { 0x90, 0x90, YM2612_status_port_1_A_r },
  712. //    { 0x92, 0x92, YM2612_status_port_1_B_r },
  713.     { 0xc0, 0xc0, soundlatch_r },
  714.     { -1 }    /* end of table */
  715. };
  716.  
  717.  
  718. static struct IOWritePort sound_writeport_18[] =
  719. {
  720.     { 0x80, 0x80, YM2612_control_port_0_A_w },
  721.     { 0x81, 0x81, YM2612_data_port_0_A_w },
  722.     { 0x82, 0x82, YM2612_control_port_0_B_w },
  723.     { 0x83, 0x83, YM2612_data_port_0_B_w },
  724.     { 0x90, 0x90, YM2612_control_port_1_A_w },
  725.     { 0x91, 0x91, YM2612_data_port_1_A_w },
  726.     { 0x92, 0x92, YM2612_control_port_1_B_w },
  727.     { 0x93, 0x93, YM2612_data_port_1_B_w },
  728.     { 0xa0, 0xa0, sys18_soundbank_w },
  729.     { -1 }
  730. };
  731.  
  732. static struct YM2612interface ym3438_interface =
  733. {
  734.     2,    /* 2 chips */
  735.     8000000,
  736.     { 40,40 },
  737.     { 0 },    { 0 },    { 0 },    { 0 }
  738. };
  739.  
  740.  
  741. // Sega 3D Sound
  742.  
  743.  
  744. static struct YM2203interface ym2203_interface =
  745. {
  746.     1,    /* 1 chips */
  747.     4096000,    /* 3.58 MHZ ? */
  748.     { YM2203_VOL(50,50) },
  749.     { 0 },
  750.     { 0 },
  751.     { 0 },
  752.     { 0 },
  753.     { 0 }
  754. };
  755.  
  756. static struct YM2203interface ym2203_interface2 =
  757. {
  758.     3,    /* 1 chips */
  759.     4096000,    /* 3.58 MHZ ? */
  760.     { YM2203_VOL(50,50),YM2203_VOL(50,50),YM2203_VOL(50,50) },
  761.     { 0 },
  762.     { 0 },
  763.     { 0 },
  764.     { 0 },
  765.     { 0 }
  766. };
  767.  
  768. static struct SEGAPCMinterface segapcm_interface_15k = {
  769.     SEGAPCM_SAMPLE15K,
  770.     BANK_256,
  771.     REGION_SOUND1,        // memory region
  772.     50
  773. };
  774.  
  775. static struct SEGAPCMinterface segapcm_interface_15k_512 = {
  776.     SEGAPCM_SAMPLE15K,
  777.     BANK_512,
  778.     REGION_SOUND1,        // memory region
  779.     50
  780. };
  781.  
  782. static struct SEGAPCMinterface segapcm_interface_32k = {
  783.     SEGAPCM_SAMPLE32K,
  784.     BANK_256,
  785.     REGION_SOUND1,
  786.     50
  787. };
  788.  
  789.  
  790. // Super hang-on, outrun
  791.  
  792. // hopefully this is endian safe!
  793. static unsigned char *sound_shared_ram;
  794. static READ_HANDLER( sound_shared_ram_r )
  795. {
  796.     return (sound_shared_ram[offset] << 8) + sound_shared_ram[offset+1];
  797. }
  798.  
  799. static WRITE_HANDLER( sound_shared_ram_w )
  800. {
  801.     int val=(sound_shared_ram[offset] << 8) + sound_shared_ram[offset+1];
  802.     val=(val & (data>>16)) | (data &0xffff);
  803.  
  804.     sound_shared_ram[offset] = val>>8;
  805.     sound_shared_ram[offset+1] = val&0xff;
  806. }
  807.  
  808.  
  809. static READ_HANDLER( sound2_shared_ram_r ) { return sound_shared_ram[offset]; }
  810. static WRITE_HANDLER( sound2_shared_ram_w ) { sound_shared_ram[offset] = data; }
  811.  
  812. static WRITE_HANDLER( sound_command_w ){
  813.     logerror("SOUND COMMAND %04x <- %02x\n", offset, data&0xff );
  814.     soundlatch_w( 0,data&0xff );
  815.     cpu_cause_interrupt( 1, 0 );
  816. }
  817.  
  818. static WRITE_HANDLER( sound_command_nmi_w ){
  819.     logerror("SOUND COMMAND %04x <- %02x\n", offset, data&0xff );
  820.     soundlatch_w( 0,data&0xff );
  821.     cpu_set_nmi_line(1, PULSE_LINE);
  822. }
  823.  
  824. static struct YM2151interface ym2151_interface =
  825. {
  826.     1,            /* 1 chip */
  827.     4096000,    /* 3.58 MHZ ? */
  828.     { YM3012_VOL(40,MIXER_PAN_LEFT,40,MIXER_PAN_RIGHT) },
  829.     { 0 }
  830. };
  831.  
  832.  
  833.  
  834.  
  835. /***************************************************************************/
  836.  
  837. static struct GfxLayout charlayout1 =
  838. {
  839.     8,8,    /* 8*8 chars */
  840.     8192,    /* 8192 chars */
  841.     3,    /* 3 bits per pixel */
  842.     { 0x20000*8, 0x10000*8, 0 },
  843.         { 0, 1, 2, 3, 4, 5, 6, 7 },
  844.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  845.     8*8    /* every sprite takes 8 consecutive bytes */
  846. };
  847.  
  848. static struct GfxLayout charlayout2 =
  849. {
  850.     8,8,    /* 8*8 chars */
  851.     16384,    /* 16384 chars */
  852.     3,    /* 3 bits per pixel */
  853.     { 0x40000*8, 0x20000*8, 0 },
  854.         { 0, 1, 2, 3, 4, 5, 6, 7 },
  855.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  856.     8*8    /* every sprite takes 8 consecutive bytes */
  857. };
  858.  
  859. static struct GfxLayout charlayout4 =
  860. {
  861.     8,8,    /* 8*8 chars */
  862.     32768,    /* 32768 chars */
  863.     3,    /* 3 bits per pixel */
  864.     { 0x80000*8, 0x40000*8, 0 },
  865.         { 0, 1, 2, 3, 4, 5, 6, 7 },
  866.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  867.     8*8    /* every sprite takes 8 consecutive bytes */
  868. };
  869.  
  870. static struct GfxLayout charlayout8 =
  871. {
  872.     8,8,    /* 8*8 chars */
  873.     4096,    /* 4096 chars */
  874.     3,    /* 3 bits per pixel */
  875.     { 0x10000*8, 0x08000*8, 0 },
  876.         { 0, 1, 2, 3, 4, 5, 6, 7 },
  877.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  878.     8*8    /* every sprite takes 8 consecutive bytes */
  879. };
  880.  
  881. static struct GfxDecodeInfo gfx1[] =
  882. {
  883.     { REGION_GFX1, 0x00000, &charlayout1,    0, 256 },
  884.     { -1 } /* end of array */
  885. };
  886.  
  887. static struct GfxDecodeInfo gfx2[] =
  888. {
  889.     { REGION_GFX1, 0x00000, &charlayout2,    0, 256 },
  890.     { -1 } /* end of array */
  891. };
  892.  
  893. static struct GfxDecodeInfo gfx4[] =
  894. {
  895.     { REGION_GFX1, 0x00000, &charlayout4,    0, 256 },
  896.     { -1 } /* end of array */
  897. };
  898.  
  899. static struct GfxDecodeInfo gfx8[] =
  900. {
  901.     { REGION_GFX1, 0x00000, &charlayout8,    0, 256 },
  902.     { -1 } /* end of array */
  903. };
  904.  
  905. /***************************************************************************/
  906.  
  907. static void set_refresh( int data ){
  908.     sys16_refreshenable = data&0x20;
  909.     sys16_clear_screen  = data&1;
  910. }
  911.  
  912. static void set_refresh_18( int data ){
  913.     sys16_refreshenable = data&0x2;
  914. //    sys16_clear_screen  = data&4;
  915. }
  916.  
  917. static void set_refresh_3d( int data ){
  918.     sys16_refreshenable = data&0x10;
  919. }
  920.  
  921.  
  922. static void set_tile_bank( int data ){
  923.     sys16_tile_bank1 = data&0xf;
  924.     sys16_tile_bank0 = (data>>4)&0xf;
  925. }
  926.  
  927. static void set_tile_bank18( int data ){
  928.     sys16_tile_bank0 = data&0xf;
  929.     sys16_tile_bank1 = (data>>4)&0xf;
  930. }
  931.  
  932. static void set_fg_page( int data ){
  933.     sys16_fg_page[0] = data>>12;
  934.     sys16_fg_page[1] = (data>>8)&0xf;
  935.     sys16_fg_page[2] = (data>>4)&0xf;
  936.     sys16_fg_page[3] = data&0xf;
  937. }
  938.  
  939. static void set_bg_page( int data ){
  940.     sys16_bg_page[0] = data>>12;
  941.     sys16_bg_page[1] = (data>>8)&0xf;
  942.     sys16_bg_page[2] = (data>>4)&0xf;
  943.     sys16_bg_page[3] = data&0xf;
  944. }
  945.  
  946. static void set_fg_page1( int data ){
  947.     sys16_fg_page[1] = data>>12;
  948.     sys16_fg_page[0] = (data>>8)&0xf;
  949.     sys16_fg_page[3] = (data>>4)&0xf;
  950.     sys16_fg_page[2] = data&0xf;
  951. }
  952.  
  953. static void set_bg_page1( int data ){
  954.     sys16_bg_page[1] = data>>12;
  955.     sys16_bg_page[0] = (data>>8)&0xf;
  956.     sys16_bg_page[3] = (data>>4)&0xf;
  957.     sys16_bg_page[2] = data&0xf;
  958. }
  959.  
  960. static void set_fg2_page( int data ){
  961.     sys16_fg2_page[0] = data>>12;
  962.     sys16_fg2_page[1] = (data>>8)&0xf;
  963.     sys16_fg2_page[2] = (data>>4)&0xf;
  964.     sys16_fg2_page[3] = data&0xf;
  965. }
  966.  
  967. static void set_bg2_page( int data ){
  968.     sys16_bg2_page[0] = data>>12;
  969.     sys16_bg2_page[1] = (data>>8)&0xf;
  970.     sys16_bg2_page[2] = (data>>4)&0xf;
  971.     sys16_bg2_page[3] = data&0xf;
  972. }
  973.  
  974.  
  975. /***************************************************************************/
  976. /*    Important: you must leave extra space when listing sprite ROMs
  977.     in a ROM module definition.  This routine unpacks each sprite nibble
  978.     into a byte, doubling the memory consumption. */
  979.  
  980. static void sys16_sprite_decode( int num_banks, int bank_size ){
  981.     unsigned char *base = memory_region(REGION_GFX2);
  982.     unsigned char *temp = malloc( bank_size );
  983.     int i;
  984.  
  985.     if( !temp ) return;
  986.  
  987.     for( i = num_banks; i >0; i-- ){
  988.         unsigned char *finish    = base + 2*bank_size*i;
  989.         unsigned char *dest = finish - 2*bank_size;
  990.  
  991.         unsigned char *p1 = temp;
  992.         unsigned char *p2 = temp+bank_size/2;
  993.  
  994.         unsigned char data;
  995.  
  996.         memcpy (temp, base+bank_size*(i-1), bank_size);
  997.  
  998. /*
  999.     note: both pen#0 and pen#15 are transparent.
  1000.     we replace references to pen#15 with pen#0, to simplify the sprite rendering
  1001. */
  1002.         do {
  1003.             data = *p2++;
  1004. #ifdef SPRITE_SIDE_MARKERS
  1005.             if( (data&0x0f) == 0x0f )
  1006.             {
  1007.                 if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
  1008.                     *dest++ = data >> 4;
  1009.                 else
  1010.                     *dest++ = 0xff;
  1011.                 *dest++ = 0xff;
  1012.             }
  1013.             else if( (data&0xf0) == 0xf0 )
  1014.             {
  1015.                 *dest++ = 0x00;
  1016.                 if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1017.                 *dest++ = data &0xf;
  1018.             }
  1019.             else
  1020.             {
  1021.                 *dest++ = data >> 4;
  1022.                 *dest++ = data & 0xF;
  1023.             }
  1024. #else
  1025.             {
  1026.                 if( (data&0xf0) == 0xf0 ) data &= 0x0f;
  1027.                 if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1028.                 *dest++ = data >> 4;
  1029.                 *dest++ = data & 0xF;
  1030.             }
  1031. #endif
  1032.  
  1033.             data = *p1++;
  1034. #ifdef SPRITE_SIDE_MARKERS
  1035.             if( (data&0x0f) == 0x0f )
  1036.             {
  1037.                 if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
  1038.                     *dest++ = data >> 4;
  1039.                 else
  1040.                     *dest++ = 0xff;
  1041.                 *dest++ = 0xff;
  1042.             }
  1043.             else if( (data&0xf0) == 0xf0 )
  1044.             {
  1045.                 *dest++ = 0x00;
  1046.                 if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1047.                 *dest++ = data &0xf;
  1048.             }
  1049.             else
  1050.             {
  1051.                 *dest++ = data >> 4;
  1052.                 *dest++ = data & 0xF;
  1053.             }
  1054. #else
  1055.             {
  1056.                 if( (data&0xf0) == 0xf0 ) data &= 0x0f;
  1057.                 if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1058.                 *dest++ = data >> 4;
  1059.                 *dest++ = data & 0xF;
  1060.             }
  1061. #endif
  1062.         } while( dest<finish );
  1063.     }
  1064.     free( temp );
  1065. }
  1066.  
  1067. static void sys16_sprite_decode2( int num_banks, int bank_size, int side_markers ){
  1068.     unsigned char *base = memory_region(REGION_GFX2);
  1069.     unsigned char *temp = malloc( bank_size );
  1070.     int i;
  1071.  
  1072.     if( !temp ) return;
  1073.  
  1074.     for( i = num_banks; i >0; i-- ){
  1075.         unsigned char *finish    = base + 2*bank_size*i;
  1076.         unsigned char *dest = finish - 2*bank_size;
  1077.  
  1078.         unsigned char *p1 = temp;
  1079.         unsigned char *p2 = temp+bank_size/4;
  1080.         unsigned char *p3 = temp+bank_size/2;
  1081.         unsigned char *p4 = temp+bank_size/4*3;
  1082.  
  1083.         unsigned char data;
  1084.  
  1085.         memcpy (temp, base+bank_size*(i-1), bank_size);
  1086.  
  1087. /*
  1088.     note: both pen#0 and pen#15 are transparent.
  1089.     we replace references to pen#15 with pen#0, to simplify the sprite rendering
  1090. */
  1091.         do {
  1092.             data = *p4++;
  1093. #ifdef SPRITE_SIDE_MARKERS
  1094.             if( side_markers )
  1095.             {
  1096.                 if( (data&0x0f) == 0x0f )
  1097.                 {
  1098.                     if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
  1099.                         *dest++ = data >> 4;
  1100.                     else
  1101.                         *dest++ = 0xff;
  1102.                     *dest++ = 0xff;
  1103.                 }
  1104.                 else if( (data&0xf0) == 0xf0 )
  1105.                 {
  1106.                     *dest++ = 0x00;
  1107.                     if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1108.                     *dest++ = data &0xf;
  1109.                 }
  1110.                 else
  1111.                 {
  1112.                     *dest++ = data >> 4;
  1113.                     *dest++ = data & 0xF;
  1114.                 }
  1115.             }
  1116.             else
  1117. #endif
  1118.             {
  1119.                 if( (data&0xf0) == 0xf0 ) data &= 0x0f;
  1120.                 if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1121.                 *dest++ = data >> 4;
  1122.                 *dest++ = data & 0xF;
  1123.             }
  1124.  
  1125.             data = *p3++;
  1126. #ifdef SPRITE_SIDE_MARKERS
  1127.             if( side_markers )
  1128.             {
  1129.                 if( (data&0x0f) == 0x0f )
  1130.                 {
  1131.                     if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
  1132.                         *dest++ = data >> 4;
  1133.                     else
  1134.                         *dest++ = 0xff;
  1135.                     *dest++ = 0xff;
  1136.                 }
  1137.                 else if( (data&0xf0) == 0xf0 )
  1138.                 {
  1139.                     *dest++ = 0x00;
  1140.                     if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1141.                     *dest++ = data &0xf;
  1142.                 }
  1143.                 else
  1144.                 {
  1145.                     *dest++ = data >> 4;
  1146.                     *dest++ = data & 0xF;
  1147.                 }
  1148.             }
  1149.             else
  1150. #endif
  1151.             {
  1152.                 if( (data&0xf0) == 0xf0 ) data &= 0x0f;
  1153.                 if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1154.                 *dest++ = data >> 4;
  1155.                 *dest++ = data & 0xF;
  1156.             }
  1157.  
  1158.  
  1159.             data = *p2++;
  1160. #ifdef SPRITE_SIDE_MARKERS
  1161.             if( side_markers )
  1162.             {
  1163.                 if( (data&0x0f) == 0x0f )
  1164.                 {
  1165.                     if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
  1166.                         *dest++ = data >> 4;
  1167.                     else
  1168.                         *dest++ = 0xff;
  1169.                     *dest++ = 0xff;
  1170.                 }
  1171.                 else if( (data&0xf0) == 0xf0 )
  1172.                 {
  1173.                     *dest++ = 0x00;
  1174.                     if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1175.                     *dest++ = data &0xf;
  1176.                 }
  1177.                 else
  1178.                 {
  1179.                     *dest++ = data >> 4;
  1180.                     *dest++ = data & 0xF;
  1181.                 }
  1182.             }
  1183.             else
  1184. #endif
  1185.             {
  1186.                 if( (data&0xf0) == 0xf0 ) data &= 0x0f;
  1187.                 if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1188.                 *dest++ = data >> 4;
  1189.                 *dest++ = data & 0xF;
  1190.             }
  1191.  
  1192.             data = *p1++;
  1193. #ifdef SPRITE_SIDE_MARKERS
  1194.             if( side_markers )
  1195.             {
  1196.                 if( (data&0x0f) == 0x0f )
  1197.                 {
  1198.                     if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
  1199.                         *dest++ = data >> 4;
  1200.                     else
  1201.                         *dest++ = 0xff;
  1202.                     *dest++ = 0xff;
  1203.                 }
  1204.                 else if( (data&0xf0) == 0xf0 )
  1205.                 {
  1206.                     *dest++ = 0x00;
  1207.                     if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1208.                     *dest++ = data &0xf;
  1209.                 }
  1210.                 else
  1211.                 {
  1212.                     *dest++ = data >> 4;
  1213.                     *dest++ = data & 0xF;
  1214.                 }
  1215.             }
  1216.             else
  1217. #endif
  1218.             {
  1219.                 if( (data&0xf0) == 0xf0 ) data &= 0x0f;
  1220.                 if( (data&0x0f) == 0x0f ) data &= 0xf0;
  1221.                 *dest++ = data >> 4;
  1222.                 *dest++ = data & 0xF;
  1223.             }
  1224.  
  1225.         } while( dest<finish );
  1226.     }
  1227.     free( temp );
  1228. }
  1229.  
  1230. int gr_bitmap_width;
  1231.  
  1232. static void generate_gr_screen(int w,int bitmap_width,int skip,int start_color,int end_color,int source_size)
  1233. {
  1234.     UINT8 *buf;
  1235.     UINT8 *gr = memory_region(REGION_GFX3);
  1236.     UINT8 *grr = NULL;
  1237.     int i,j,k;
  1238.     int center_offset=0;
  1239.  
  1240.  
  1241.     buf=malloc(source_size);
  1242.     if(buf==NULL) return;
  1243.  
  1244.     gr_bitmap_width = bitmap_width;
  1245.  
  1246.     memcpy(buf,gr,source_size);
  1247.     memset(gr,0,256*bitmap_width);
  1248.  
  1249.     if (w!=gr_bitmap_width)
  1250.     {
  1251.         if (skip>0) // needs mirrored RHS
  1252.             grr=gr;
  1253.         else
  1254.         {
  1255.             center_offset=(gr_bitmap_width-w);
  1256.             gr+=center_offset/2;
  1257.         }
  1258.     }
  1259.  
  1260.     // build gr_bitmap
  1261.     for (i=0; i<256; i++)
  1262.     {
  1263.         UINT8 last_bit;
  1264.         UINT8 color_data[4];
  1265.  
  1266.         color_data[0]=start_color; color_data[1]=start_color+1;
  1267.         color_data[2]=start_color+2; color_data[3]=start_color+3;
  1268.         last_bit=((buf[0]&0x80)==0)|(((buf[0x4000]&0x80)==0)<<1);
  1269.         for (j=0; j<w/8; j++)
  1270.         {
  1271.             for (k=0; k<8; k++)
  1272.             {
  1273.                 UINT8 bit=((buf[0]&0x80)==0)|(((buf[0x4000]&0x80)==0)<<1);
  1274.                 if (bit!=last_bit && bit==0 && i>1)
  1275.                 { // color flipped to 0,advance color[0]
  1276.                     if (color_data[0]+end_color <= end_color)
  1277.                     {
  1278.                         color_data[0]+=end_color;
  1279.                     }
  1280.                     else
  1281.                     {
  1282.                         color_data[0]-=end_color;
  1283.                     }
  1284.                 }
  1285.                 *gr = color_data[bit];
  1286.                 last_bit=bit;
  1287.                 buf[0] <<= 1; buf[0x4000] <<= 1; gr++;
  1288.             }
  1289.             buf++;
  1290.         }
  1291.  
  1292.         if (grr!=NULL)
  1293.         { // need mirrored RHS
  1294.             UINT8 *_gr=gr-1;
  1295.             _gr -= skip;
  1296.             for (j=0; j<w-skip; j++)
  1297.             {
  1298.                 *gr++ = *_gr--;
  1299.             }
  1300.             for (j=0; j<skip; j++) *gr++ = 0;
  1301.         }
  1302.         else if (center_offset!=0)
  1303.         {
  1304.             gr+=center_offset;
  1305.         }
  1306.     }
  1307.  
  1308.     i=1;
  1309.     while ( (1<<i) < gr_bitmap_width ) i++;
  1310.     gr_bitmap_width=i; // power of 2
  1311.  
  1312. }
  1313.  
  1314.  
  1315. /***************************************************************************/
  1316.  
  1317. #define io_player1_r input_port_0_r
  1318. #define io_player2_r input_port_1_r
  1319. #define io_player3_r input_port_5_r
  1320. #define io_player4_r input_port_6_r
  1321. #define io_service_r input_port_2_r
  1322.  
  1323. #define io_dip1_r input_port_3_r
  1324. #define io_dip2_r input_port_4_r
  1325. #define io_dip3_r input_port_5_r
  1326.  
  1327. /***************************************************************************/
  1328.  
  1329.  
  1330. static void patch_codeX( int offset, int data, int cpu ){
  1331.     int aligned_offset = offset&0xfffffe;
  1332.     unsigned char *RAM = memory_region(REGION_CPU1+cpu);
  1333.     int old_word = READ_WORD( &RAM[aligned_offset] );
  1334.  
  1335.     if( offset&1 )
  1336.         data = (old_word&0xff00)|data;
  1337.     else
  1338.         data = (old_word&0x00ff)|(data<<8);
  1339.  
  1340.     WRITE_WORD (&RAM[aligned_offset], data);
  1341. }
  1342.  
  1343. static void patch_code( int offset, int data ) {patch_codeX(offset,data,0);}
  1344. static void patch_code2( int offset, int data ) {patch_codeX(offset,data,2);}
  1345.  
  1346. static void patch_z80code( int offset, int data ){
  1347.     unsigned char *RAM = memory_region(REGION_CPU2);
  1348.     RAM[offset] = data;
  1349. }
  1350.  
  1351. /***************************************************************************/
  1352.  
  1353. #define SYS16_JOY1 PORT_START \
  1354.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) \
  1355.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) \
  1356.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) \
  1357.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
  1358.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY ) \
  1359.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY ) \
  1360.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY ) \
  1361.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  1362.  
  1363. #define SYS16_JOY2 PORT_START \
  1364.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL ) \
  1365.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL ) \
  1366.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL ) \
  1367.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
  1368.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL ) \
  1369.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL ) \
  1370.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL ) \
  1371.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  1372.  
  1373. #define SYS16_JOY3 PORT_START \
  1374.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 ) \
  1375.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 ) \
  1376.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 ) \
  1377.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
  1378.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER3 ) \
  1379.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER3 ) \
  1380.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 ) \
  1381.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER3 )
  1382.  
  1383. #define SYS16_JOY1_SWAPPEDBUTTONS PORT_START \
  1384.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) \
  1385.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) \
  1386.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) \
  1387.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
  1388.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY ) \
  1389.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY ) \
  1390.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY ) \
  1391.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  1392.  
  1393. #define SYS16_JOY2_SWAPPEDBUTTONS PORT_START \
  1394.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL ) \
  1395.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL ) \
  1396.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL ) \
  1397.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
  1398.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL ) \
  1399.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL ) \
  1400.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL ) \
  1401.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  1402.  
  1403. #define SYS16_SERVICE PORT_START \
  1404.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) \
  1405.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) \
  1406.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE ) \
  1407.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 ) \
  1408.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) \
  1409.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) \
  1410.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
  1411.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  1412.  
  1413. #define SYS16_COINAGE PORT_START \
  1414.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) \
  1415.     PORT_DIPSETTING(    0x07, DEF_STR( 4C_1C ) ) \
  1416.     PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) ) \
  1417.     PORT_DIPSETTING(    0x09, DEF_STR( 2C_1C ) ) \
  1418.     PORT_DIPSETTING(    0x05, "2 Coins/1 Credit 5/3 6/4") \
  1419.     PORT_DIPSETTING(    0x04, "2 Coins/1 Credit 4/3") \
  1420.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) ) \
  1421.     PORT_DIPSETTING(    0x01, "1 Coin/1 Credit 2/3") \
  1422.     PORT_DIPSETTING(    0x02, "1 Coin/1 Credit 4/5") \
  1423.     PORT_DIPSETTING(    0x03, "1 Coin/1 Credit 5/6") \
  1424.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) ) \
  1425.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) ) \
  1426.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) ) \
  1427.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) ) \
  1428.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) ) \
  1429.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) ) \
  1430.     PORT_DIPSETTING(    0x00, "Free Play (if Coin B too) or 1/1") \
  1431.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) \
  1432.     PORT_DIPSETTING(    0x70, DEF_STR( 4C_1C ) ) \
  1433.     PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) ) \
  1434.     PORT_DIPSETTING(    0x90, DEF_STR( 2C_1C ) ) \
  1435.     PORT_DIPSETTING(    0x50, "2 Coins/1 Credit 5/3 6/4") \
  1436.     PORT_DIPSETTING(    0x40, "2 Coins/1 Credit 4/3") \
  1437.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) ) \
  1438.     PORT_DIPSETTING(    0x10, "1 Coin/1 Credit 2/3") \
  1439.     PORT_DIPSETTING(    0x20, "1 Coin/1 Credit 4/5") \
  1440.     PORT_DIPSETTING(    0x30, "1 Coin/1 Credit 5/6") \
  1441.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_3C ) ) \
  1442.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) ) \
  1443.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) ) \
  1444.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) ) \
  1445.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) ) \
  1446.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) ) \
  1447.     PORT_DIPSETTING(    0x00, "Free Play (if Coin A too) or 1/1")
  1448.  
  1449.  
  1450.  
  1451. /***************************************************************************/
  1452. // sys16A
  1453. ROM_START( alexkidd )
  1454.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  1455.     ROM_LOAD_EVEN( "epr10429.42", 0x000000, 0x10000, 0xbdf49eca )
  1456.     ROM_LOAD_ODD ( "epr10427.26", 0x000000, 0x10000, 0xf6e3dd29 )
  1457.     ROM_LOAD_EVEN( "epr10430.43", 0x020000, 0x10000, 0x89e3439f )
  1458.     ROM_LOAD_ODD ( "epr10428.25", 0x020000, 0x10000, 0xdbed3210 )
  1459.  
  1460.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  1461.     ROM_LOAD( "10431.95", 0x00000, 0x08000, 0xa7962c39 )
  1462.     ROM_LOAD( "10432.94", 0x08000, 0x08000, 0xdb8cd24e )
  1463.     ROM_LOAD( "10433.93", 0x10000, 0x08000, 0xe163c8c2 )
  1464.  
  1465.     ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites */
  1466.     ROM_LOAD( "10437.10", 0x000000, 0x008000, 0x522f7618 )
  1467.     ROM_LOAD( "10441.11", 0x008000, 0x008000, 0x74e3a35c )
  1468.     ROM_LOAD( "10438.17", 0x010000, 0x008000, 0x738a6362 )
  1469.     ROM_LOAD( "10442.18", 0x018000, 0x008000, 0x86cb9c14 )
  1470.     ROM_LOAD( "10439.23", 0x020000, 0x008000, 0xb391aca7 )
  1471.     ROM_LOAD( "10443.24", 0x028000, 0x008000, 0x95d32635 )
  1472.     ROM_LOAD( "10440.29", 0x030000, 0x008000, 0x23939508 )
  1473.     ROM_LOAD( "10444.30", 0x038000, 0x008000, 0x82115823 )
  1474. //    ROM_LOAD( "10437.10", 0x040000, 0x008000, 0x522f7618 ) twice?
  1475. //    ROM_LOAD( "10441.11", 0x048000, 0x008000, 0x74e3a35c ) twice?
  1476.  
  1477.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  1478.     ROM_LOAD( "10434.12", 0x0000, 0x8000, 0x77141cce )
  1479.  
  1480.     ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
  1481.     ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
  1482.  
  1483.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* 7751 sound data (not used yet) */
  1484.     ROM_LOAD( "10435.1", 0x0000, 0x8000, 0xad89f6e3 )
  1485.     ROM_LOAD( "10436.2", 0x8000, 0x8000, 0x96c76613 )
  1486. ROM_END
  1487.  
  1488. ROM_START( alexkida )
  1489.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  1490.     ROM_LOAD_EVEN( "10447.43", 0x000000, 0x10000, 0x29e87f71 )
  1491.     ROM_LOAD_ODD ( "10445.26", 0x000000, 0x10000, 0x25ce5b6f )
  1492.     ROM_LOAD_EVEN( "10448.42", 0x020000, 0x10000, 0x05baedb5 )
  1493.     ROM_LOAD_ODD ( "10446.25", 0x020000, 0x10000, 0xcd61d23c )
  1494.  
  1495.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  1496.     ROM_LOAD( "10431.95", 0x00000, 0x08000, 0xa7962c39 )
  1497.     ROM_LOAD( "10432.94", 0x08000, 0x08000, 0xdb8cd24e )
  1498.     ROM_LOAD( "10433.93", 0x10000, 0x08000, 0xe163c8c2 )
  1499.  
  1500.     ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites */
  1501.     ROM_LOAD( "10437.10", 0x000000, 0x008000, 0x522f7618 )
  1502.     ROM_LOAD( "10441.11", 0x008000, 0x008000, 0x74e3a35c )
  1503.     ROM_LOAD( "10438.17", 0x010000, 0x008000, 0x738a6362 )
  1504.     ROM_LOAD( "10442.18", 0x018000, 0x008000, 0x86cb9c14 )
  1505.     ROM_LOAD( "10439.23", 0x020000, 0x008000, 0xb391aca7 )
  1506.     ROM_LOAD( "10443.24", 0x028000, 0x008000, 0x95d32635 )
  1507.     ROM_LOAD( "10440.29", 0x030000, 0x008000, 0x23939508 )
  1508.     ROM_LOAD( "10444.30", 0x038000, 0x008000, 0x82115823 )
  1509. //    ROM_LOAD( "10437.10", 0x040000, 0x008000, 0x522f7618 ) twice?
  1510. //    ROM_LOAD( "10441.11", 0x048000, 0x008000, 0x74e3a35c ) twice?
  1511.  
  1512.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  1513.     ROM_LOAD( "10434.12", 0x0000, 0x8000, 0x77141cce )
  1514.  
  1515.     ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
  1516.     ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
  1517.  
  1518.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* 7751 sound data */
  1519.     ROM_LOAD( "10435.1", 0x0000, 0x8000, 0xad89f6e3 )
  1520.     ROM_LOAD( "10436.2", 0x8000, 0x8000, 0x96c76613 )
  1521. ROM_END
  1522.  
  1523. /***************************************************************************/
  1524.  
  1525. static READ_HANDLER( alexkidd_skip_r )
  1526. {
  1527.     if (cpu_get_pc()==0x242c) {cpu_spinuntil_int(); return 0xffff;}
  1528.  
  1529.     return READ_WORD(&sys16_workingram[0x3108]);
  1530. }
  1531.  
  1532. static struct MemoryReadAddress alexkidd_readmem[] =
  1533. {
  1534.     { 0x000000, 0x03ffff, MRA_ROM },
  1535.     { 0x400000, 0x40ffff, MRA_TILERAM },
  1536.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  1537.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  1538.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  1539.     { 0xc40002, 0xc40005, MRA_NOP },        //??
  1540.     { 0xc41002, 0xc41003, io_player1_r },
  1541.     { 0xc41006, 0xc41007, io_player2_r },
  1542.     { 0xc41000, 0xc41001, io_service_r },
  1543.     { 0xc42000, 0xc42001, io_dip1_r },
  1544.     { 0xc42002, 0xc42003, io_dip2_r },
  1545.     { 0xc60000, 0xc60001, MRA_NOP },
  1546.     { 0xfff108, 0xfff109, alexkidd_skip_r },
  1547.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  1548.     {-1}
  1549. };
  1550.  
  1551. static struct MemoryWriteAddress alexkidd_writemem[] =
  1552. {
  1553.     { 0x000000, 0x03ffff, MWA_ROM },
  1554.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  1555.     { 0x400000, 0x40ffff, MWA_TILERAM },
  1556.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  1557.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  1558.     { 0xc40000, 0xc40001, sound_command_nmi_w },
  1559.     { 0xc40002, 0xc40005, MWA_NOP },        //??
  1560.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  1561.     {-1}
  1562. };
  1563. /***************************************************************************/
  1564.  
  1565. static void alexkidd_update_proc( void ){
  1566.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
  1567.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
  1568.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
  1569.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
  1570.  
  1571.     set_fg_page1( READ_WORD( &sys16_textram[0x0e9e] ) );
  1572.     set_bg_page1( READ_WORD( &sys16_textram[0x0e9c] ) );
  1573. }
  1574.  
  1575. static void alexkidd_init_machine( void ){
  1576.     static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
  1577.     sys16_obj_bank = bank;
  1578.     sys16_textmode=1;
  1579.     sys16_spritesystem = 2;
  1580.     sys16_sprxoffset = -0xbc;
  1581.     sys16_fgxoffset = sys16_bgxoffset = 7;
  1582.     sys16_bg_priority_mode=1;
  1583.  
  1584.     sys16_update_proc = alexkidd_update_proc;
  1585. }
  1586.  
  1587. static void init_alexkidd( void )
  1588. {
  1589.     sys16_onetime_init_machine();
  1590.     sys16_sprite_decode( 5,0x010000 );
  1591. }
  1592. /***************************************************************************/
  1593.  
  1594. INPUT_PORTS_START( alexkidd )
  1595.     SYS16_JOY1_SWAPPEDBUTTONS
  1596.     SYS16_JOY2_SWAPPEDBUTTONS
  1597.     SYS16_SERVICE
  1598.     SYS16_COINAGE
  1599.  
  1600. PORT_START    /* DSW1 */
  1601.     PORT_DIPNAME( 0x01, 0x00, "Continues" )
  1602.     PORT_DIPSETTING(    0x01, "Only before level 5" )
  1603.     PORT_DIPSETTING(    0x00, "Unlimited" )
  1604.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  1605.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  1606.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1607.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  1608.     PORT_DIPSETTING(    0x0c, "3" )
  1609.     PORT_DIPSETTING(    0x08, "4" )
  1610.     PORT_DIPSETTING(    0x04, "5" )
  1611.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "240", IP_KEY_NONE, IP_JOY_NONE )
  1612.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) )
  1613.     PORT_DIPSETTING(    0x20, "10000" )
  1614.     PORT_DIPSETTING(    0x30, "20000" )
  1615.     PORT_DIPSETTING(    0x10, "40000" )
  1616.     PORT_DIPSETTING(    0x00, "None" )
  1617.     PORT_DIPNAME( 0xc0, 0xc0, "Time Adjust" )
  1618.     PORT_DIPSETTING(    0x80, "70" )
  1619.     PORT_DIPSETTING(    0xc0, "60" )
  1620.     PORT_DIPSETTING(    0x40, "50" )
  1621.     PORT_DIPSETTING(    0x00, "40" )
  1622.  
  1623. INPUT_PORTS_END
  1624.  
  1625. /***************************************************************************/
  1626.  
  1627. MACHINE_DRIVER_7751( machine_driver_alexkidd, \
  1628.     alexkidd_readmem,alexkidd_writemem,alexkidd_init_machine,gfx8 )
  1629.  
  1630. /***************************************************************************/
  1631. // sys16B
  1632. ROM_START( aliensyn )
  1633.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  1634.     ROM_LOAD_EVEN( "11083.a4", 0x00000, 0x8000, 0xcb2ad9b3 )
  1635.     ROM_LOAD_ODD ( "11080.a1", 0x00000, 0x8000, 0xfe7378d9 )
  1636.     ROM_LOAD_EVEN( "11084.a5", 0x10000, 0x8000, 0x2e1ec7b1 )
  1637.     ROM_LOAD_ODD ( "11081.a2", 0x10000, 0x8000, 0x1308ee63 )
  1638.     ROM_LOAD_EVEN( "11085.a6", 0x20000, 0x8000, 0xcff78f39 )
  1639.     ROM_LOAD_ODD ( "11082.a3", 0x20000, 0x8000, 0x9cdc2a14 )
  1640.  
  1641.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  1642.     ROM_LOAD( "10702.b9",  0x00000, 0x10000, 0x393bc813 )
  1643.     ROM_LOAD( "10703.b10", 0x10000, 0x10000, 0x6b6dd9f5 )
  1644.     ROM_LOAD( "10704.b11", 0x20000, 0x10000, 0x911e7ebc )
  1645.  
  1646.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  1647.     ROM_LOAD( "10709.b1", 0x00000, 0x10000, 0xaddf0a90 )
  1648.     ROM_LOAD( "10713.b5", 0x10000, 0x10000, 0xececde3a )
  1649.     ROM_LOAD( "10710.b2", 0x20000, 0x10000, 0x992369eb )
  1650.     ROM_LOAD( "10714.b6", 0x30000, 0x10000, 0x91bf42fb )
  1651.     ROM_LOAD( "10711.b3", 0x40000, 0x10000, 0x29166ef6 )
  1652.     ROM_LOAD( "10715.b7", 0x50000, 0x10000, 0xa7c57384 )
  1653.     ROM_LOAD( "10712.b4", 0x60000, 0x10000, 0x876ad019 )
  1654.     ROM_LOAD( "10716.b8", 0x70000, 0x10000, 0x40ba1d48 )
  1655.  
  1656.     ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
  1657.     ROM_LOAD( "10723.a7", 0x0000, 0x8000, 0x99953526 )
  1658.     ROM_LOAD( "10724.a8", 0x10000, 0x8000, 0xf971a817 )
  1659.     ROM_LOAD( "10725.a9", 0x18000, 0x8000, 0x6a50e08f )
  1660.     ROM_LOAD( "10726.a10",0x20000, 0x8000, 0xd50b7736 )
  1661. ROM_END
  1662.  
  1663. // sys16A - use a different sound chip?
  1664. ROM_START( aliensya )
  1665.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code. I guessing the order a bit here */
  1666.     ROM_LOAD_EVEN( "10808", 0x00000, 0x8000, 0xe669929f )
  1667.     ROM_LOAD_ODD ( "10806", 0x00000, 0x8000, 0x9f7f8fdd )
  1668.     ROM_LOAD_EVEN( "10809", 0x10000, 0x8000, 0x9a424919 )
  1669.     ROM_LOAD_ODD ( "10807", 0x10000, 0x8000, 0x3d2c3530 )
  1670.     ROM_LOAD_EVEN( "10701", 0x20000, 0x8000, 0x92171751 )
  1671.     ROM_LOAD_ODD ( "10698", 0x20000, 0x8000, 0xc1e4fdc0 )
  1672.  
  1673.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  1674.     ROM_LOAD( "10739", 0x00000, 0x10000, 0xa29ec207 )
  1675.     ROM_LOAD( "10740", 0x10000, 0x10000, 0x47f93015 )
  1676.     ROM_LOAD( "10741", 0x20000, 0x10000, 0x4970739c )
  1677.  
  1678.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  1679.     ROM_LOAD( "10709.b1", 0x00000, 0x10000, 0xaddf0a90 )
  1680.     ROM_LOAD( "10713.b5", 0x10000, 0x10000, 0xececde3a )
  1681.     ROM_LOAD( "10710.b2", 0x20000, 0x10000, 0x992369eb )
  1682.     ROM_LOAD( "10714.b6", 0x30000, 0x10000, 0x91bf42fb )
  1683.     ROM_LOAD( "10711.b3", 0x40000, 0x10000, 0x29166ef6 )
  1684.     ROM_LOAD( "10715.b7", 0x50000, 0x10000, 0xa7c57384 )
  1685.     ROM_LOAD( "10712.b4", 0x60000, 0x10000, 0x876ad019 )
  1686.     ROM_LOAD( "10716.b8", 0x70000, 0x10000, 0x40ba1d48 )
  1687.  
  1688.     ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
  1689.     ROM_LOAD( "10705", 0x00000, 0x8000, 0x777b749e )
  1690.     ROM_LOAD( "10706", 0x10000, 0x8000, 0xaa114acc )
  1691.     ROM_LOAD( "10707", 0x18000, 0x8000, 0x800c1d82 )
  1692.     ROM_LOAD( "10708", 0x20000, 0x8000, 0x5921ef52 )
  1693. ROM_END
  1694.  
  1695. ROM_START( aliensyj )
  1696.     ROM_REGION( 0x030000, REGION_CPU1 ) /* Custom 68000 code . I guessing the order a bit here */
  1697. // custom cpu 317-0033
  1698.     ROM_LOAD_EVEN( "epr10699.43", 0x00000, 0x8000, 0x3fd38d17 )
  1699.     ROM_LOAD_ODD ( "epr10696.26", 0x00000, 0x8000, 0xd734f19f )
  1700.     ROM_LOAD_EVEN( "epr10700.42", 0x10000, 0x8000, 0x3b04b252 )
  1701.     ROM_LOAD_ODD ( "epr10697.25", 0x10000, 0x8000, 0xf2bc123d )
  1702.     ROM_LOAD_EVEN( "10701", 0x20000, 0x8000, 0x92171751 )
  1703.     ROM_LOAD_ODD ( "10698", 0x20000, 0x8000, 0xc1e4fdc0 )
  1704.  
  1705.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  1706.     ROM_LOAD( "10739", 0x00000, 0x10000, 0xa29ec207 )
  1707.     ROM_LOAD( "10740", 0x10000, 0x10000, 0x47f93015 )
  1708.     ROM_LOAD( "10741", 0x20000, 0x10000, 0x4970739c )
  1709.  
  1710.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  1711.     ROM_LOAD( "10709.b1", 0x00000, 0x10000, 0xaddf0a90 )
  1712.     ROM_LOAD( "10713.b5", 0x10000, 0x10000, 0xececde3a )
  1713.     ROM_LOAD( "10710.b2", 0x20000, 0x10000, 0x992369eb )
  1714.     ROM_LOAD( "10714.b6", 0x30000, 0x10000, 0x91bf42fb )
  1715.     ROM_LOAD( "10711.b3", 0x40000, 0x10000, 0x29166ef6 )
  1716.     ROM_LOAD( "10715.b7", 0x50000, 0x10000, 0xa7c57384 )
  1717.     ROM_LOAD( "10712.b4", 0x60000, 0x10000, 0x876ad019 )
  1718.     ROM_LOAD( "10716.b8", 0x70000, 0x10000, 0x40ba1d48 )
  1719.  
  1720.     ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
  1721.     ROM_LOAD( "10705", 0x00000, 0x8000, 0x777b749e )
  1722.     ROM_LOAD( "10706", 0x10000, 0x8000, 0xaa114acc )
  1723.     ROM_LOAD( "10707", 0x18000, 0x8000, 0x800c1d82 )
  1724.     ROM_LOAD( "10708", 0x20000, 0x8000, 0x5921ef52 )
  1725. ROM_END
  1726.  
  1727.  
  1728. ROM_START( aliensyb )
  1729.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  1730.     ROM_LOAD_EVEN( "as_typeb.a4", 0x00000, 0x8000, 0x17bf5304 )
  1731.     ROM_LOAD_ODD ( "as_typeb.a1", 0x00000, 0x8000, 0x4cd134df )
  1732.     ROM_LOAD_EVEN( "as_typeb.a5", 0x10000, 0x8000, 0xc8b791b0 )
  1733.     ROM_LOAD_ODD ( "as_typeb.a2", 0x10000, 0x8000, 0xbdcf4a30 )
  1734.     ROM_LOAD_EVEN( "as_typeb.a6", 0x20000, 0x8000, 0x1d0790aa )
  1735.     ROM_LOAD_ODD ( "as_typeb.a3", 0x20000, 0x8000, 0x1e7586b7 )
  1736.  
  1737.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  1738.     ROM_LOAD( "10702.b9",  0x00000, 0x10000, 0x393bc813 )
  1739.     ROM_LOAD( "10703.b10", 0x10000, 0x10000, 0x6b6dd9f5 )
  1740.     ROM_LOAD( "10704.b11", 0x20000, 0x10000, 0x911e7ebc )
  1741.  
  1742.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  1743.     ROM_LOAD( "10709.b1", 0x00000, 0x10000, 0xaddf0a90 )
  1744.     ROM_LOAD( "10713.b5", 0x10000, 0x10000, 0xececde3a )
  1745.     ROM_LOAD( "10710.b2", 0x20000, 0x10000, 0x992369eb )
  1746.     ROM_LOAD( "10714.b6", 0x30000, 0x10000, 0x91bf42fb )
  1747.     ROM_LOAD( "10711.b3", 0x40000, 0x10000, 0x29166ef6 )
  1748.     ROM_LOAD( "10715.b7", 0x50000, 0x10000, 0xa7c57384 )
  1749.     ROM_LOAD( "10712.b4", 0x60000, 0x10000, 0x876ad019 )
  1750.     ROM_LOAD( "10716.b8", 0x70000, 0x10000, 0x40ba1d48 )
  1751.  
  1752.     ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
  1753.     ROM_LOAD( "10723.a7", 0x0000, 0x8000, 0x99953526 )
  1754.     ROM_LOAD( "10724.a8", 0x10000, 0x8000, 0xf971a817 )
  1755.     ROM_LOAD( "10725.a9", 0x18000, 0x8000, 0x6a50e08f )
  1756.     ROM_LOAD( "10726.a10",0x20000, 0x8000, 0xd50b7736 )
  1757. ROM_END
  1758.  
  1759.  
  1760.  
  1761.  
  1762. /***************************************************************************/
  1763.  
  1764. static struct MemoryReadAddress aliensyn_readmem[] =
  1765. {
  1766.     { 0x000000, 0x02ffff, MRA_ROM },
  1767.     { 0x400000, 0x40ffff, MRA_TILERAM },
  1768.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  1769.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  1770.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  1771.     { 0xc41002, 0xc41003, io_player1_r },
  1772.     { 0xc41006, 0xc41007, io_player2_r },
  1773.     { 0xc41000, 0xc41001, io_service_r },
  1774.     { 0xc42002, 0xc42003, io_dip1_r },
  1775.     { 0xc42000, 0xc42001, io_dip2_r },
  1776.     { 0xc40000, 0xc40fff, MRA_EXTRAM },
  1777.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  1778.     {-1}
  1779. };
  1780.  
  1781. static struct MemoryWriteAddress aliensyn_writemem[] =
  1782. {
  1783.     { 0x000000, 0x02ffff, MWA_ROM },
  1784.     { 0x400000, 0x40ffff, MWA_TILERAM },
  1785.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  1786.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  1787.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  1788.     { 0xc00006, 0xc00007, sound_command_w },
  1789.     { 0xc40000, 0xc40fff, MWA_EXTRAM },
  1790.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  1791.     {-1}
  1792. };
  1793.  
  1794. /***************************************************************************/
  1795.  
  1796. static void aliensyn_update_proc( void ){
  1797.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  1798.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  1799.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  1800.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  1801.  
  1802.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  1803.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  1804.  
  1805.     set_refresh( READ_WORD( &sys16_extraram[0] ) ); // 0xc40001
  1806. }
  1807.  
  1808. static void aliensyn_init_machine( void ){
  1809.     static int bank[16] = { 0,0,0,0,0,0,0,6,0,0,0,4,0,2,0,0 };
  1810.     sys16_obj_bank = bank;
  1811.     sys16_bg_priority_mode=1;
  1812.     sys16_fg_priority_mode=1;
  1813.  
  1814.     sys16_update_proc = aliensyn_update_proc;
  1815. }
  1816.  
  1817. static void aliensyn_sprite_decode( void ){
  1818.     sys16_sprite_decode( 4,0x20000 );
  1819. }
  1820.  
  1821. static void init_aliensyn( void )
  1822. {
  1823.     sys16_onetime_init_machine();
  1824.     sys16_bg1_trans=1;
  1825.     aliensyn_sprite_decode();
  1826. }
  1827.  
  1828. /***************************************************************************/
  1829.  
  1830. INPUT_PORTS_START( aliensyn )
  1831.     SYS16_JOY1
  1832.     SYS16_JOY2
  1833.     SYS16_SERVICE
  1834.     SYS16_COINAGE
  1835.  
  1836. PORT_START    /* DSW1 */
  1837.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
  1838.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  1839.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1840.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  1841.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  1842.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1843.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  1844.     PORT_DIPSETTING(    0x08, "2" )
  1845.     PORT_DIPSETTING(    0x0c, "3" )
  1846.     PORT_DIPSETTING(    0x04, "4" )
  1847.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "127", IP_KEY_NONE, IP_JOY_NONE )
  1848.     PORT_DIPNAME( 0x30, 0x30, "Timer" )
  1849.     PORT_DIPSETTING(    0x00, "120" )
  1850.     PORT_DIPSETTING(    0x10, "130" )
  1851.     PORT_DIPSETTING(    0x20, "140" )
  1852.     PORT_DIPSETTING(    0x30, "150" )
  1853.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
  1854.     PORT_DIPSETTING(    0x80, "Easy" )
  1855.     PORT_DIPSETTING(    0xc0, "Normal" )
  1856.     PORT_DIPSETTING(    0x40, "Hard" )
  1857.     PORT_DIPSETTING(    0x00, "Hardest" )
  1858. INPUT_PORTS_END
  1859.  
  1860. /***************************************************************************/
  1861.  
  1862. static struct UPD7759_interface aliensyn_upd7759_interface =
  1863. {
  1864.     1,            /* 1 chip */
  1865.     480000,
  1866.     { 60 },     /* volumes */
  1867.     { REGION_CPU2 },            /* memory region 3 contains the sample data */
  1868.     UPD7759_SLAVE_MODE,
  1869.     { sound_cause_nmi },
  1870. };
  1871.  
  1872. /****************************************************************************/
  1873.  
  1874. MACHINE_DRIVER_7759( machine_driver_aliensyn, \
  1875.     aliensyn_readmem,aliensyn_writemem,aliensyn_init_machine, gfx1, aliensyn_upd7759_interface )
  1876.  
  1877. /***************************************************************************/
  1878. // sys16B
  1879. ROM_START( altbeast )
  1880.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  1881.     ROM_LOAD_EVEN( "11705", 0x000000, 0x20000, 0x57dc5c7a )
  1882.     ROM_LOAD_ODD ( "11704", 0x000000, 0x20000, 0x33bbcf07 )
  1883.  
  1884.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  1885.     ROM_LOAD( "11674", 0x00000, 0x20000, 0xa57a66d5 )
  1886.     ROM_LOAD( "11675", 0x20000, 0x20000, 0x2ef2f144 )
  1887.     ROM_LOAD( "11676", 0x40000, 0x20000, 0x0c04acac )
  1888.  
  1889.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  1890.     ROM_LOAD( "epr11677.b1", 0x00000, 0x10000, 0xa01425cd )
  1891.     ROM_CONTINUE(            0x20000, 0x10000 )
  1892.     ROM_LOAD( "epr11681.b5", 0x10000, 0x10000, 0xd9e03363 )
  1893.     ROM_CONTINUE(            0x30000, 0x10000 )
  1894.     ROM_LOAD( "epr11678.b2", 0x40000, 0x10000, 0x17a9fc53 )
  1895.     ROM_CONTINUE(            0x60000, 0x10000 )
  1896.     ROM_LOAD( "epr11682.b6", 0x50000, 0x10000, 0xe3f77c5e )
  1897.     ROM_CONTINUE(            0x70000, 0x10000 )
  1898.     ROM_LOAD( "epr11679.b3", 0x80000, 0x10000, 0x14dcc245 )
  1899.     ROM_CONTINUE(            0xa0000, 0x10000 )
  1900.     ROM_LOAD( "epr11683.b7", 0x90000, 0x10000, 0xf9a60f06 )
  1901.     ROM_CONTINUE(            0xb0000, 0x10000 )
  1902.     ROM_LOAD( "epr11680.b4", 0xc0000, 0x10000, 0xf43dcdec )
  1903.     ROM_CONTINUE(            0xe0000, 0x10000 )
  1904.     ROM_LOAD( "epr11684.b8", 0xd0000, 0x10000, 0xb20c0edb )
  1905.     ROM_CONTINUE(            0xf0000, 0x10000 )
  1906.  
  1907.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  1908.     ROM_LOAD( "11671",         0x00000, 0x08000, 0x2b71343b )
  1909.     ROM_LOAD( "opr11672",    0x10000, 0x20000, 0xbbd7f460 )
  1910.     ROM_LOAD( "opr11673",    0x30000, 0x20000, 0x400c4a36 )
  1911. ROM_END
  1912.  
  1913. ROM_START( jyuohki )
  1914.     ROM_REGION( 0x040000, REGION_CPU1 ) /* Custom 68000 code. */
  1915. // custom cpu 317-0065
  1916.     ROM_LOAD_EVEN( "epr11670.a7", 0x000000, 0x20000, 0xb748eb07 )
  1917.     ROM_LOAD_ODD ( "epr11669.a5", 0x000000, 0x20000, 0x005ecd11 )
  1918.  
  1919.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  1920.     ROM_LOAD( "11674", 0x00000, 0x20000, 0xa57a66d5 )
  1921.     ROM_LOAD( "11675", 0x20000, 0x20000, 0x2ef2f144 )
  1922.     ROM_LOAD( "11676", 0x40000, 0x20000, 0x0c04acac )
  1923.  
  1924.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  1925.     ROM_LOAD( "epr11677.b1", 0x00000, 0x10000, 0xa01425cd )
  1926.     ROM_CONTINUE(            0x20000, 0x10000 )
  1927.     ROM_LOAD( "epr11681.b5", 0x10000, 0x10000, 0xd9e03363 )
  1928.     ROM_CONTINUE(            0x30000, 0x10000 )
  1929.     ROM_LOAD( "epr11678.b2", 0x40000, 0x10000, 0x17a9fc53 )
  1930.     ROM_CONTINUE(            0x60000, 0x10000 )
  1931.     ROM_LOAD( "epr11682.b6", 0x50000, 0x10000, 0xe3f77c5e )
  1932.     ROM_CONTINUE(            0x70000, 0x10000 )
  1933.     ROM_LOAD( "epr11679.b3", 0x80000, 0x10000, 0x14dcc245 )
  1934.     ROM_CONTINUE(            0xa0000, 0x10000 )
  1935.     ROM_LOAD( "epr11683.b7", 0x90000, 0x10000, 0xf9a60f06 )
  1936.     ROM_CONTINUE(            0xb0000, 0x10000 )
  1937.     ROM_LOAD( "epr11680.b4", 0xc0000, 0x10000, 0xf43dcdec )
  1938.     ROM_CONTINUE(            0xe0000, 0x10000 )
  1939.     ROM_LOAD( "epr11684.b8", 0xd0000, 0x10000, 0xb20c0edb )
  1940.     ROM_CONTINUE(            0xf0000, 0x10000 )
  1941.  
  1942.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  1943.     ROM_LOAD( "11671",         0x00000, 0x08000, 0x2b71343b )
  1944.     ROM_LOAD( "opr11672",    0x10000, 0x20000, 0xbbd7f460 )
  1945.     ROM_LOAD( "opr11673",    0x30000, 0x20000, 0x400c4a36 )
  1946. ROM_END
  1947.  
  1948. // sys16B
  1949. ROM_START( altbeas2 )
  1950.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  1951.     ROM_LOAD_EVEN( "epr11740", 0x000000, 0x20000, 0xce227542 )
  1952.     ROM_LOAD_ODD ( "epr11739", 0x000000, 0x20000, 0xe466eb65 )
  1953.  
  1954.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  1955.     ROM_LOAD( "11674", 0x00000, 0x20000, 0xa57a66d5 )
  1956.     ROM_LOAD( "11675", 0x20000, 0x20000, 0x2ef2f144 )
  1957.     ROM_LOAD( "11676", 0x40000, 0x20000, 0x0c04acac )
  1958.  
  1959.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  1960.     ROM_LOAD( "epr11677.b1", 0x00000, 0x10000, 0xa01425cd )
  1961.     ROM_CONTINUE(            0x20000, 0x10000 )
  1962.     ROM_LOAD( "epr11681.b5", 0x10000, 0x10000, 0xd9e03363 )
  1963.     ROM_CONTINUE(            0x30000, 0x10000 )
  1964.     ROM_LOAD( "epr11678.b2", 0x40000, 0x10000, 0x17a9fc53 )
  1965.     ROM_CONTINUE(            0x60000, 0x10000 )
  1966.     ROM_LOAD( "epr11682.b6", 0x50000, 0x10000, 0xe3f77c5e )
  1967.     ROM_CONTINUE(            0x70000, 0x10000 )
  1968.     ROM_LOAD( "epr11679.b3", 0x80000, 0x10000, 0x14dcc245 )
  1969.     ROM_CONTINUE(            0xa0000, 0x10000 )
  1970.     ROM_LOAD( "epr11683.b7", 0x90000, 0x10000, 0xf9a60f06 )
  1971.     ROM_CONTINUE(            0xb0000, 0x10000 )
  1972.     ROM_LOAD( "epr11680.b4", 0xc0000, 0x10000, 0xf43dcdec )
  1973.     ROM_CONTINUE(            0xe0000, 0x10000 )
  1974.     ROM_LOAD( "epr11684.b8", 0xd0000, 0x10000, 0xb20c0edb )
  1975.     ROM_CONTINUE(            0xf0000, 0x10000 )
  1976.  
  1977.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  1978.     ROM_LOAD( "opr11686",     0x00000, 0x08000, 0x828a45b3 )    // ???
  1979.     ROM_LOAD( "opr11672",    0x10000, 0x20000, 0xbbd7f460 )
  1980.     ROM_LOAD( "opr11673",    0x30000, 0x20000, 0x400c4a36 )
  1981. ROM_END
  1982.  
  1983.  
  1984.  
  1985. /***************************************************************************/
  1986.  
  1987. static READ_HANDLER( altbeast_skip_r )
  1988. {
  1989.     if (cpu_get_pc()==0x3994) {cpu_spinuntil_int(); return 1<<8;}
  1990.  
  1991.     return READ_WORD(&sys16_workingram[0x301c]);
  1992. }
  1993.  
  1994. // ??? What is this, input test shows 4 bits to each player, but what does it do?
  1995. static READ_HANDLER( altbeast_io_r )
  1996. {
  1997.     return 0xff;
  1998. }
  1999.  
  2000. static struct MemoryReadAddress altbeast_readmem[] =
  2001. {
  2002.     { 0x000000, 0x03ffff, MRA_ROM },
  2003.     { 0x400000, 0x40ffff, MRA_TILERAM },
  2004.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  2005.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  2006.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  2007.     { 0xc41002, 0xc41003, io_player1_r },
  2008.     { 0xc41006, 0xc41007, io_player2_r },
  2009.     { 0xc41004, 0xc41005, altbeast_io_r },
  2010.     { 0xc41000, 0xc41001, io_service_r },
  2011.     { 0xc42002, 0xc42003, io_dip1_r },
  2012.     { 0xc42000, 0xc42001, io_dip2_r },
  2013.     { 0xc40000, 0xc40fff, MRA_EXTRAM },
  2014.     { 0xfff01c, 0xfff01d, altbeast_skip_r },
  2015.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  2016.     {-1}
  2017. };
  2018.  
  2019. static struct MemoryWriteAddress altbeast_writemem[] =
  2020. {
  2021.     { 0x000000, 0x03ffff, MWA_ROM },
  2022.     { 0x400000, 0x40ffff, MWA_TILERAM },
  2023.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  2024.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  2025.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  2026.     { 0xc40000, 0xc40fff, MWA_EXTRAM },
  2027.     { 0xfe0006, 0xfe0007, sound_command_w },
  2028.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  2029.     {-1}
  2030. };
  2031.  
  2032. /***************************************************************************/
  2033.  
  2034. static void altbeast_update_proc( void ){
  2035.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  2036.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  2037.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  2038.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  2039.  
  2040.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  2041.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  2042.  
  2043.     set_tile_bank( READ_WORD( &sys16_workingram[0x3094] ) );
  2044.     set_refresh( READ_WORD( &sys16_extraram[0] ) );
  2045. }
  2046.  
  2047. static void altbeast_init_machine( void ){
  2048.     static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
  2049.     sys16_obj_bank = bank;
  2050.     sys16_update_proc = altbeast_update_proc;
  2051. }
  2052.  
  2053. static void altbeas2_init_machine( void ){
  2054.     static int bank[16] = {0x00,0x00,0x02,0x00,0x04,0x00,0x06,0x00,0x08,0x00,0x0A,0x00,0x0C,0x00,0x00,0x00};
  2055.     sys16_obj_bank = bank;
  2056.     sys16_update_proc = altbeast_update_proc;
  2057. }
  2058.  
  2059. static void init_altbeast( void )
  2060. {
  2061.     sys16_onetime_init_machine();
  2062.     sys16_sprite_decode( 7,0x20000 );
  2063. }
  2064.  
  2065. /***************************************************************************/
  2066.  
  2067. INPUT_PORTS_START( altbeast )
  2068.     SYS16_JOY1
  2069.     SYS16_JOY2
  2070.     SYS16_SERVICE
  2071.     SYS16_COINAGE
  2072.  
  2073. PORT_START    /* DSW1 */
  2074.     PORT_DIPNAME( 0x01, 0x01, "Credits needed" )
  2075.     PORT_DIPSETTING(    0x01, "1 to start, 1 to continue")
  2076.     PORT_DIPSETTING(    0x00, "2 to start, 1 to continue")
  2077.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  2078.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  2079.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2080.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  2081.     PORT_DIPSETTING(    0x08, "2" )
  2082.     PORT_DIPSETTING(    0x0c, "3" )
  2083.     PORT_DIPSETTING(    0x04, "4" )
  2084.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "240", IP_KEY_NONE, IP_JOY_NONE )
  2085.     PORT_DIPNAME( 0x30, 0x30, "Energy Meter" )
  2086.     PORT_DIPSETTING(    0x20, "2" )
  2087.     PORT_DIPSETTING(    0x30, "3" )
  2088.     PORT_DIPSETTING(    0x10, "4" )
  2089.     PORT_DIPSETTING(    0x00, "5" )
  2090.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
  2091.     PORT_DIPSETTING(    0x80, "Easy" )
  2092.     PORT_DIPSETTING(    0xc0, "Normal" )
  2093.     PORT_DIPSETTING(    0x40, "Hard" )
  2094.     PORT_DIPSETTING(    0x00, "Hardest" )
  2095. INPUT_PORTS_END
  2096.  
  2097. /***************************************************************************/
  2098.  
  2099. MACHINE_DRIVER_7759( machine_driver_altbeast, \
  2100.     altbeast_readmem,altbeast_writemem,altbeast_init_machine, gfx2,upd7759_interface )
  2101.  
  2102. MACHINE_DRIVER_7759( machine_driver_altbeas2, \
  2103.     altbeast_readmem,altbeast_writemem,altbeas2_init_machine, gfx2,upd7759_interface )
  2104.  
  2105. /***************************************************************************/
  2106. // sys18
  2107. ROM_START( astorm )
  2108.     ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
  2109.     ROM_LOAD_EVEN( "epr13085.bin", 0x000000, 0x40000, 0x15f74e2d )
  2110.     ROM_LOAD_ODD ( "epr13084.bin", 0x000000, 0x40000, 0x9687b38f )
  2111.  
  2112.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  2113.     ROM_LOAD( "epr13073.bin", 0x00000, 0x40000, 0xdf5d0a61 )
  2114.     ROM_LOAD( "epr13074.bin", 0x40000, 0x40000, 0x787afab8 )
  2115.     ROM_LOAD( "epr13075.bin", 0x80000, 0x40000, 0x4e01b477 )
  2116.  
  2117.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  2118.     ROM_LOAD( "mpr13082.bin", 0x000000, 0x40000, 0xa782b704 )
  2119.     ROM_LOAD( "mpr13089.bin", 0x040000, 0x40000, 0x2a4227f0 )
  2120.     ROM_LOAD( "mpr13081.bin", 0x080000, 0x40000, 0xeb510228 )
  2121.     ROM_LOAD( "mpr13088.bin", 0x0c0000, 0x40000, 0x3b6b4c55 )
  2122.     ROM_LOAD( "mpr13080.bin", 0x100000, 0x40000, 0xe668eefb )
  2123.     ROM_LOAD( "mpr13087.bin", 0x140000, 0x40000, 0x2293427d )
  2124.     ROM_LOAD( "epr13079.bin", 0x180000, 0x40000, 0xde9221ed )
  2125.     ROM_LOAD( "epr13086.bin", 0x1c0000, 0x40000, 0x8c9a71c4 )
  2126.  
  2127.     ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
  2128.     ROM_LOAD( "epr13083.bin", 0x10000, 0x20000, 0x5df3af20 )
  2129.     ROM_LOAD( "epr13076.bin", 0x30000, 0x40000, 0x94e6c76e )
  2130.     ROM_LOAD( "epr13077.bin", 0x70000, 0x40000, 0xe2ec0d8d )
  2131.     ROM_LOAD( "epr13078.bin", 0xb0000, 0x40000, 0x15684dc5 )
  2132. ROM_END
  2133.  
  2134. ROM_START( astorm2p )
  2135.     ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
  2136.     ROM_LOAD_EVEN( "epr13182.bin", 0x000000, 0x40000, 0xe31f2a1c )
  2137.     ROM_LOAD_ODD ( "epr13181.bin", 0x000000, 0x40000, 0x78cd3b26 )
  2138.  
  2139.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  2140.     ROM_LOAD( "epr13073.bin", 0x00000, 0x40000, 0xdf5d0a61 )
  2141.     ROM_LOAD( "epr13074.bin", 0x40000, 0x40000, 0x787afab8 )
  2142.     ROM_LOAD( "epr13075.bin", 0x80000, 0x40000, 0x4e01b477 )
  2143.  
  2144.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  2145.     ROM_LOAD( "mpr13082.bin", 0x000000, 0x40000, 0xa782b704 )
  2146.     ROM_LOAD( "mpr13089.bin", 0x040000, 0x40000, 0x2a4227f0 )
  2147.     ROM_LOAD( "mpr13081.bin", 0x080000, 0x40000, 0xeb510228 )
  2148.     ROM_LOAD( "mpr13088.bin", 0x0c0000, 0x40000, 0x3b6b4c55 )
  2149.     ROM_LOAD( "mpr13080.bin", 0x100000, 0x40000, 0xe668eefb )
  2150.     ROM_LOAD( "mpr13087.bin", 0x140000, 0x40000, 0x2293427d )
  2151.     ROM_LOAD( "epr13079.bin", 0x180000, 0x40000, 0xde9221ed )
  2152.     ROM_LOAD( "epr13086.bin", 0x1c0000, 0x40000, 0x8c9a71c4 )
  2153.  
  2154.     ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
  2155.     ROM_LOAD( "ep13083a.bin", 0x10000, 0x20000, 0xe7528e06 )
  2156.     ROM_LOAD( "epr13076.bin", 0x30000, 0x40000, 0x94e6c76e )
  2157.     ROM_LOAD( "epr13077.bin", 0x70000, 0x40000, 0xe2ec0d8d )
  2158.     ROM_LOAD( "epr13078.bin", 0xb0000, 0x40000, 0x15684dc5 )
  2159. ROM_END
  2160.  
  2161. ROM_START( astormbl )
  2162.     ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
  2163.     ROM_LOAD_EVEN( "astorm.a6", 0x000000, 0x40000, 0x7682ed3e )
  2164.     ROM_LOAD_ODD ( "astorm.a5", 0x000000, 0x40000, 0xefe9711e )
  2165.  
  2166.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  2167.     ROM_LOAD( "epr13073.bin", 0x00000, 0x40000, 0xdf5d0a61 )
  2168.     ROM_LOAD( "epr13074.bin", 0x40000, 0x40000, 0x787afab8 )
  2169.     ROM_LOAD( "epr13075.bin", 0x80000, 0x40000, 0x4e01b477 )
  2170.  
  2171.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  2172.     ROM_LOAD( "mpr13082.bin", 0x000000, 0x40000, 0xa782b704 )
  2173.     ROM_LOAD( "astorm.a11",   0x040000, 0x40000, 0x7829c4f3 )
  2174.     ROM_LOAD( "mpr13081.bin", 0x080000, 0x40000, 0xeb510228 )
  2175.     ROM_LOAD( "mpr13088.bin", 0x0c0000, 0x40000, 0x3b6b4c55 )
  2176.     ROM_LOAD( "mpr13080.bin", 0x100000, 0x40000, 0xe668eefb )
  2177.     ROM_LOAD( "mpr13087.bin", 0x140000, 0x40000, 0x2293427d )
  2178.     ROM_LOAD( "epr13079.bin", 0x180000, 0x40000, 0xde9221ed )
  2179.     ROM_LOAD( "epr13086.bin", 0x1c0000, 0x40000, 0x8c9a71c4 )
  2180.  
  2181.     ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
  2182.     ROM_LOAD( "epr13083.bin", 0x10000, 0x20000, 0x5df3af20 )
  2183.     ROM_LOAD( "epr13076.bin", 0x30000, 0x40000, 0x94e6c76e )
  2184.     ROM_LOAD( "epr13077.bin", 0x70000, 0x40000, 0xe2ec0d8d )
  2185.     ROM_LOAD( "epr13078.bin", 0xb0000, 0x40000, 0x15684dc5 )
  2186. ROM_END
  2187.  
  2188. /***************************************************************************/
  2189.  
  2190. static READ_HANDLER( astorm_skip_r )
  2191. {
  2192.     if (cpu_get_pc()==0x3d4c) {cpu_spinuntil_int(); return 0xffff;}
  2193.  
  2194.     return READ_WORD(&sys16_workingram[0x2c2c]);
  2195. }
  2196.  
  2197. static struct MemoryReadAddress astorm_readmem[] =
  2198. {
  2199.     { 0x000000, 0x07ffff, MRA_ROM },
  2200.     { 0x100000, 0x10ffff, MRA_TILERAM },
  2201.     { 0x110000, 0x110fff, MRA_TEXTRAM },
  2202.     { 0x140000, 0x140fff, MRA_PALETTERAM },
  2203.     { 0x200000, 0x200fff, MRA_SPRITERAM },
  2204.     { 0xa00000, 0xa00001, io_dip1_r },
  2205.     { 0xa00002, 0xa00003, io_dip2_r },
  2206.     { 0xa01002, 0xa01003, io_player1_r },
  2207.     { 0xa01004, 0xa01005, io_player2_r },
  2208.     { 0xa01006, 0xa01007, io_player3_r },
  2209.     { 0xa01000, 0xa01001, io_service_r },
  2210.     { 0xa00000, 0xa0ffff, MRA_EXTRAM2 },
  2211.     { 0xc00000, 0xc0ffff, MRA_EXTRAM },
  2212.     { 0xc40000, 0xc4ffff, MRA_EXTRAM3 },
  2213.     { 0xffec2c, 0xffec2d, astorm_skip_r },
  2214.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  2215.     {-1}
  2216. };
  2217.  
  2218. static struct MemoryWriteAddress astorm_writemem[] =
  2219. {
  2220.     { 0x000000, 0x07ffff, MWA_ROM },
  2221.     { 0x100000, 0x10ffff, MWA_TILERAM },
  2222.     { 0x110000, 0x110fff, MWA_TEXTRAM },
  2223.     { 0x140000, 0x140fff, MWA_PALETTERAM },
  2224.     { 0x200000, 0x200fff, MWA_SPRITERAM },
  2225.     { 0xa00006, 0xa00007, sound_command_nmi_w },
  2226.     { 0xa00000, 0xa0ffff, MWA_EXTRAM2 },
  2227.     { 0xc00000, 0xc0ffff, MWA_EXTRAM },
  2228.     { 0xc40000, 0xc4ffff, MWA_EXTRAM3 },
  2229.     { 0xfe0020, 0xfe003f, MWA_NOP },
  2230.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  2231.     {-1}
  2232. };
  2233. /***************************************************************************/
  2234.  
  2235. static void astorm_update_proc( void ){
  2236.     int data;
  2237.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  2238.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  2239.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  2240.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  2241.  
  2242.     data = READ_WORD( &sys16_textram[0x0e80] );
  2243.     sys16_fg_page[1] = data>>12;
  2244.     sys16_fg_page[3] = (data>>8)&0xf;
  2245.     sys16_fg_page[0] = (data>>4)&0xf;
  2246.     sys16_fg_page[2] = data&0xf;
  2247.  
  2248.     data = READ_WORD( &sys16_textram[0x0e82] );
  2249.     sys16_bg_page[1] = data>>12;
  2250.     sys16_bg_page[3] = (data>>8)&0xf;
  2251.     sys16_bg_page[0] = (data>>4)&0xf;
  2252.     sys16_bg_page[2] = data&0xf;
  2253.  
  2254.  
  2255.     sys16_fg2_scrollx = READ_WORD( &sys16_textram[0x0e9c] );
  2256.     sys16_bg2_scrollx = READ_WORD( &sys16_textram[0x0e9e] );
  2257.     sys16_fg2_scrolly = READ_WORD( &sys16_textram[0x0e94] );
  2258.     sys16_bg2_scrolly = READ_WORD( &sys16_textram[0x0e96] );
  2259.  
  2260.     data = READ_WORD( &sys16_textram[0x0e84] );
  2261.     sys16_fg2_page[1] = data>>12;
  2262.     sys16_fg2_page[3] = (data>>8)&0xf;
  2263.     sys16_fg2_page[0] = (data>>4)&0xf;
  2264.     sys16_fg2_page[2] = data&0xf;
  2265.  
  2266.     data = READ_WORD( &sys16_textram[0x0e86] );
  2267.     sys16_bg2_page[1] = data>>12;
  2268.     sys16_bg2_page[3] = (data>>8)&0xf;
  2269.     sys16_bg2_page[0] = (data>>4)&0xf;
  2270.     sys16_bg2_page[2] = data&0xf;
  2271.  
  2272.     if(sys16_fg2_scrollx | sys16_fg2_scrolly | READ_WORD( &sys16_textram[0x0e84] ))
  2273.         sys18_fg2_active=1;
  2274.     else
  2275.         sys18_fg2_active=0;
  2276.     if(sys16_bg2_scrollx | sys16_bg2_scrolly | READ_WORD( &sys16_textram[0x0e86] ))
  2277.         sys18_bg2_active=1;
  2278.     else
  2279.         sys18_bg2_active=0;
  2280.  
  2281.     set_tile_bank18( READ_WORD( &sys16_extraram2[0xe] ) ); // 0xa0000f
  2282.     set_refresh_18( READ_WORD( &sys16_extraram3[0x6600] ) ); // 0xc46601
  2283. }
  2284.  
  2285. static void astorm_init_machine( void ){
  2286.     static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
  2287.     sys16_obj_bank = bank;
  2288.     sys16_fgxoffset = sys16_bgxoffset = -9;
  2289.  
  2290.     patch_code( 0x2D6E, 0x32 );
  2291.     patch_code( 0x2D6F, 0x3c );
  2292.     patch_code( 0x2D70, 0x80 );
  2293.     patch_code( 0x2D71, 0x00 );
  2294.     patch_code( 0x2D72, 0x33 );
  2295.     patch_code( 0x2D73, 0xc1 );
  2296.     patch_code( 0x2ea2, 0x30 );
  2297.     patch_code( 0x2ea3, 0x38 );
  2298.     patch_code( 0x2ea4, 0xec );
  2299.     patch_code( 0x2ea5, 0xf6 );
  2300.     patch_code( 0x2ea6, 0x30 );
  2301.     patch_code( 0x2ea7, 0x80 );
  2302.     patch_code( 0x2e5c, 0x30 );
  2303.     patch_code( 0x2e5d, 0x38 );
  2304.     patch_code( 0x2e5e, 0xec );
  2305.     patch_code( 0x2e5f, 0xe2 );
  2306.     patch_code( 0x2e60, 0xc0 );
  2307.     patch_code( 0x2e61, 0x7c );
  2308.  
  2309.     patch_code( 0x4cd8, 0x02 );
  2310.     patch_code( 0x4cec, 0x03 );
  2311.     patch_code( 0x2dc6c, 0xe9 );
  2312.     patch_code( 0x2dc64, 0x10 );
  2313.     patch_code( 0x2dc65, 0x10 );
  2314.     patch_code( 0x3a100, 0x10 );
  2315.     patch_code( 0x3a101, 0x13 );
  2316.     patch_code( 0x3a102, 0x90 );
  2317.     patch_code( 0x3a103, 0x2b );
  2318.     patch_code( 0x3a104, 0x00 );
  2319.     patch_code( 0x3a105, 0x01 );
  2320.     patch_code( 0x3a106, 0x0c );
  2321.     patch_code( 0x3a107, 0x00 );
  2322.     patch_code( 0x3a108, 0x00 );
  2323.     patch_code( 0x3a109, 0x01 );
  2324.     patch_code( 0x3a10a, 0x66 );
  2325.     patch_code( 0x3a10b, 0x06 );
  2326.     patch_code( 0x3a10c, 0x42 );
  2327.     patch_code( 0x3a10d, 0x40 );
  2328.     patch_code( 0x3a10e, 0x54 );
  2329.     patch_code( 0x3a10f, 0x8b );
  2330.     patch_code( 0x3a110, 0x60 );
  2331.     patch_code( 0x3a111, 0x02 );
  2332.     patch_code( 0x3a112, 0x30 );
  2333.     patch_code( 0x3a113, 0x1b );
  2334.     patch_code( 0x3a114, 0x34 );
  2335.     patch_code( 0x3a115, 0xc0 );
  2336.     patch_code( 0x3a116, 0x34 );
  2337.     patch_code( 0x3a117, 0xdb );
  2338.     patch_code( 0x3a118, 0x24 );
  2339.     patch_code( 0x3a119, 0xdb );
  2340.     patch_code( 0x3a11a, 0x24 );
  2341.     patch_code( 0x3a11b, 0xdb );
  2342.     patch_code( 0x3a11c, 0x4e );
  2343.     patch_code( 0x3a11d, 0x75 );
  2344.     patch_code( 0xaf8e, 0x66 );
  2345.  
  2346.     /* fix missing credit text */
  2347.     patch_code( 0x3f9a, 0xec );
  2348.     patch_code( 0x3f9b, 0x36 );
  2349.  
  2350.     sys16_update_proc = astorm_update_proc;
  2351. }
  2352.  
  2353. static void init_astorm( void )
  2354. {
  2355.     unsigned char *RAM= memory_region(REGION_CPU2);
  2356.     sys16_onetime_init_machine();
  2357.     sys18_splittab_fg_x=&sys16_textram[0x0f80];
  2358.     sys18_splittab_bg_x=&sys16_textram[0x0fc0];
  2359.  
  2360.     memcpy(RAM,&RAM[0x10000],0xa000);
  2361.     sys16_MaxShadowColors=0;        // doesn't seem to use transparent shadows
  2362.  
  2363.     sys16_sprite_decode( 4,0x080000 );
  2364. }
  2365.  
  2366. /***************************************************************************/
  2367.  
  2368. INPUT_PORTS_START( astorm )
  2369.     PORT_START /* player 1 */
  2370.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
  2371.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  2372.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
  2373.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  2374.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  2375.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  2376.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  2377.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  2378.  
  2379.     PORT_START /* player 2 */
  2380.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  2381.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  2382.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  2383.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  2384.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
  2385.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
  2386.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  2387.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
  2388.  
  2389.     PORT_START
  2390.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
  2391.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  2392.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  2393.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 )
  2394.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
  2395.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  2396.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 )
  2397.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  2398.     SYS16_COINAGE
  2399.  
  2400.     PORT_START    /* DSW1 */
  2401.     PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
  2402.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  2403.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2404.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  2405.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  2406.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2407.     PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Difficulty ) )
  2408.     PORT_DIPSETTING(    0x04, "Easiest" )
  2409.     PORT_DIPSETTING(    0x08, "Easier" )
  2410.     PORT_DIPSETTING(    0x0c, "Easy" )
  2411.     PORT_DIPSETTING(    0x1c, "Normal" )
  2412.     PORT_DIPSETTING(    0x10, "Hard" )
  2413.     PORT_DIPSETTING(    0x14, "Harder" )
  2414.     PORT_DIPSETTING(    0x18, "Hardest" )
  2415.     PORT_DIPSETTING(    0x00, "Special" )
  2416.     PORT_DIPNAME( 0x20, 0x20, "Coin Chutes" )
  2417.     PORT_DIPSETTING(    0x20, "3" )
  2418.     PORT_DIPSETTING(    0x00, "1" )
  2419.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
  2420.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  2421.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2422.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
  2423.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  2424.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2425.  
  2426.     PORT_START /* player 3 */
  2427.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  2428.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  2429.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
  2430.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  2431.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER3 )
  2432.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER3 )
  2433.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 )
  2434.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER3 )
  2435. INPUT_PORTS_END
  2436.  
  2437. /***************************************************************************/
  2438.  
  2439. MACHINE_DRIVER_18( machine_driver_astorm, \
  2440.     astorm_readmem,astorm_writemem,astorm_init_machine, gfx4 )
  2441.  
  2442. /***************************************************************************/
  2443. // sys16B
  2444. ROM_START( atomicp )
  2445.     ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
  2446.     ROM_LOAD_EVEN( "ap-t2.bin", 0x000000, 0x10000, 0x97421047 )
  2447.     ROM_LOAD_ODD ( "ap-t1.bin", 0x000000, 0x10000, 0x5c65fe56 )
  2448.  
  2449.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  2450.     ROM_LOAD( "ap-t4.bin",  0x00000, 0x8000, 0x332e58f4 )
  2451.     ROM_LOAD( "ap-t3.bin",  0x08000, 0x8000, 0xdddc122c )
  2452.     ROM_LOAD( "ap-t5.bin",  0x10000, 0x8000, 0xef5ecd6b )
  2453.  
  2454.     ROM_REGION( 0x1, REGION_GFX2 ) /* sprites */
  2455.  
  2456. ROM_END
  2457.  
  2458. /***************************************************************************/
  2459.  
  2460. static READ_HANDLER( atomicp_skip_r )
  2461. {
  2462.     if (cpu_get_pc()==0x7fc) {cpu_spinuntil_int(); return 0xffff;}
  2463.  
  2464.     return READ_WORD(&sys16_workingram[0x0902]);
  2465. }
  2466.  
  2467.  
  2468. static struct MemoryReadAddress atomicp_readmem[] =
  2469. {
  2470.     { 0x000000, 0x01ffff, MRA_ROM },
  2471.     { 0x400000, 0x40ffff, MRA_TILERAM },
  2472.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  2473.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  2474.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  2475.     { 0xc41000, 0xc41001, io_player1_r },
  2476.     { 0xc41002, 0xc41003, io_player2_r },
  2477.     { 0xc41004, 0xc41005, io_dip1_r },
  2478.     { 0xc41006, 0xc41007, io_dip2_r },
  2479. //    { 0xffc902, 0xffc903, atomicp_skip_r },
  2480.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  2481.     {-1}
  2482. };
  2483.  
  2484. static WRITE_HANDLER( atomicp_sound_w )
  2485. {
  2486.     if(offset==0)
  2487.         YM2413_register_port_0_w(0,(data>>8)&0xff);
  2488.     else
  2489.         YM2413_data_port_0_w(0,(data>>8)&0xff);
  2490. }
  2491.  
  2492. static struct MemoryWriteAddress atomicp_writemem[] =
  2493. {
  2494.     { 0x000000, 0x01ffff, MWA_ROM },
  2495.     { 0x080000, 0x080003, atomicp_sound_w },
  2496.     { 0x3f0000, 0x3f0003, MWA_NOP },
  2497.     { 0x400000, 0x40ffff, MWA_TILERAM },
  2498.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  2499.     { 0x440000, 0x44ffff, MWA_SPRITERAM },
  2500.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  2501.     { 0xc40000, 0xc40001, MWA_EXTRAM2 },
  2502.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  2503.     {-1}
  2504. };
  2505.  
  2506. //    { 0x0a, 0x0a, YM2413_register_port_0_w },
  2507. //    { 0x0b, 0x0b, YM2413_data_port_0_w },
  2508.  
  2509. /***************************************************************************/
  2510.  
  2511. static void atomicp_update_proc( void ){
  2512.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  2513.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  2514.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  2515.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  2516.  
  2517.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  2518.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  2519. }
  2520.  
  2521. static void atomicp_init_machine( void ){
  2522.     static int bank[16] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
  2523.     sys16_obj_bank = bank;
  2524.     sys16_update_proc = atomicp_update_proc;
  2525. }
  2526.  
  2527. static void init_atomicp( void )
  2528. {
  2529.     sys16_onetime_init_machine();
  2530. }
  2531.  
  2532. /***************************************************************************/
  2533.  
  2534. INPUT_PORTS_START( atomicp )
  2535.  
  2536. PORT_START
  2537.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  2538.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  2539.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  2540.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  2541.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  2542.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  2543.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  2544.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  2545.  
  2546. PORT_START
  2547.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
  2548.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
  2549.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
  2550.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  2551.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  2552.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  2553.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  2554.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  2555.  
  2556. PORT_START    // dummy
  2557.  
  2558. PORT_START    // dip1
  2559.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_B ) )
  2560.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  2561.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_1C ) )
  2562.     PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
  2563.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
  2564.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  2565.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
  2566.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_4C ) )
  2567.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_5C ) )
  2568.  
  2569.     PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_A ) )
  2570.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  2571.     PORT_DIPSETTING(    0x20, DEF_STR( 3C_1C ) )
  2572.     PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) )
  2573.     PORT_DIPSETTING(    0x38, DEF_STR( 1C_1C ) )
  2574.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
  2575.     PORT_DIPSETTING(    0x28, DEF_STR( 1C_3C ) )
  2576.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_4C ) )
  2577.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_5C ) )
  2578.  
  2579.     PORT_DIPNAME( 0xC0, 0xC0, DEF_STR( Lives ) )
  2580.     PORT_DIPSETTING(    0xC0, "1" )
  2581.     PORT_DIPSETTING(    0x80, "2" )
  2582.     PORT_DIPSETTING(    0x40, "3" )
  2583.     PORT_DIPSETTING(    0x00, "5" )
  2584.  
  2585. PORT_START  //dip2
  2586.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  2587.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  2588.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2589.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  2590.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  2591.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2592.     PORT_DIPNAME( 0x04, 0x04, "Instructions" )
  2593.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  2594.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  2595.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  2596.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  2597.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2598.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  2599.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  2600.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2601.     PORT_DIPNAME( 0x20, 0x20, "Continuation" )
  2602.     PORT_DIPSETTING(    0x20, "Continue" )
  2603.     PORT_DIPSETTING(    0x00, "No Continue" )
  2604.     PORT_DIPNAME( 0x40, 0x00, "Level Select" )
  2605.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  2606.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2607.     PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
  2608. INPUT_PORTS_END
  2609.  
  2610. /***************************************************************************/
  2611. static int ap_interrupt( void ){
  2612.     int intleft=cpu_getiloops();
  2613.     if(intleft!=0) return 2;
  2614.     else return 4;
  2615. }
  2616.  
  2617. static struct YM2413interface ym2413_interface=
  2618. {
  2619.     1,
  2620.     8000000,    /* ??? */
  2621.     { 30 },
  2622. };
  2623.  
  2624. static struct MachineDriver machine_driver_atomicp =
  2625. {
  2626.     {
  2627.         {
  2628.             CPU_M68000,
  2629.             10000000,
  2630.             atomicp_readmem,atomicp_writemem,0,0,
  2631.             ap_interrupt,2
  2632.         }
  2633.     },
  2634.     60, DEFAULT_60HZ_VBLANK_DURATION,
  2635.     1,
  2636.     atomicp_init_machine,
  2637.     40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
  2638.     gfx8,
  2639.     2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
  2640.     0,
  2641.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  2642.     0,
  2643.     sys16_vh_start,
  2644.     sys16_vh_stop,
  2645.     sys16_vh_screenrefresh,
  2646.     0,0,0,0,
  2647.     {
  2648.         {
  2649.             SOUND_YM2413,
  2650.             &ym2413_interface
  2651.         }
  2652.     }
  2653. };
  2654.  
  2655. /***************************************************************************
  2656.  
  2657.    Aurail
  2658.  
  2659. ***************************************************************************/
  2660. // sys16B
  2661. ROM_START( aurail )
  2662.     ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
  2663.     ROM_LOAD_EVEN( "13577", 0x000000, 0x20000, 0x6701b686 )
  2664.     ROM_LOAD_ODD ( "13576", 0x000000, 0x20000, 0x1e428d94 )
  2665.     /* empty 0x40000 - 0x80000 */
  2666.     ROM_LOAD_EVEN( "13447", 0x080000, 0x20000, 0x70a52167 )
  2667.     ROM_LOAD_ODD ( "13445", 0x080000, 0x20000, 0x28dfc3dd )
  2668.  
  2669.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  2670.     ROM_LOAD( "aurail.a14", 0x00000, 0x20000, 0x0fc4a7a8 ) /* plane 1 */
  2671.     ROM_LOAD( "aurail.b14", 0x20000, 0x20000, 0xe08135e0 )
  2672.     ROM_LOAD( "aurail.a15", 0x40000, 0x20000, 0x1c49852f ) /* plane 2 */
  2673.     ROM_LOAD( "aurail.b15", 0x60000, 0x20000, 0xe14c6684 )
  2674.     ROM_LOAD( "aurail.a16", 0x80000, 0x20000, 0x047bde5e ) /* plane 3 */
  2675.     ROM_LOAD( "aurail.b16", 0xa0000, 0x20000, 0x6309fec4 )
  2676.  
  2677.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  2678.     ROM_LOAD( "aurail.b1",  0x000000, 0x020000, 0x5fa0a9f8 )
  2679.     ROM_LOAD( "aurail.b5",  0x020000, 0x020000, 0x0d1b54da )
  2680.     ROM_LOAD( "aurail.b2",  0x040000, 0x020000, 0x5f6b33b1 )
  2681.     ROM_LOAD( "aurail.b6",  0x060000, 0x020000, 0xbad340c3 )
  2682.     ROM_LOAD( "aurail.b3",  0x080000, 0x020000, 0x4e80520b )
  2683.     ROM_LOAD( "aurail.b7",  0x0a0000, 0x020000, 0x7e9165ac )
  2684.     ROM_LOAD( "aurail.b4",  0x0c0000, 0x020000, 0x5733c428 )
  2685.     ROM_LOAD( "aurail.b8",  0x0e0000, 0x020000, 0x66b8f9b3 )
  2686.     ROM_LOAD( "aurail.a1",  0x100000, 0x020000, 0x4f370b2b )
  2687.     ROM_LOAD( "aurail.b10", 0x120000, 0x020000, 0xf76014bf )
  2688.     ROM_LOAD( "aurail.a2",  0x140000, 0x020000, 0x37cf9cb4 )
  2689.     ROM_LOAD( "aurail.b11", 0x160000, 0x020000, 0x1061e7da )
  2690.     ROM_LOAD( "aurail.a3",  0x180000, 0x020000, 0x049698ef )
  2691.     ROM_LOAD( "aurail.b12", 0x1a0000, 0x020000, 0x7dbcfbf1 )
  2692.     ROM_LOAD( "aurail.a4",  0x1c0000, 0x020000, 0x77a8989e )
  2693.     ROM_LOAD( "aurail.b13", 0x1e0000, 0x020000, 0x551df422 )
  2694.  
  2695.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  2696.     ROM_LOAD( "13448",      0x0000, 0x8000, 0xb5183fb9 )
  2697.     ROM_LOAD( "aurail.a12", 0x10000,0x20000, 0xd3d9aaf9 )
  2698.     ROM_LOAD( "aurail.a12", 0x30000,0x20000, 0xd3d9aaf9 )
  2699. ROM_END
  2700.  
  2701. ROM_START( auraila )
  2702.     ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
  2703. // custom cpu 317-0168
  2704.     ROM_LOAD_EVEN( "epr13469.a7", 0x000000, 0x20000, 0xc628b69d )
  2705.     ROM_LOAD_ODD ( "epr13468.a5", 0x000000, 0x20000, 0xce092218 )
  2706.     /* 0x40000 - 0x80000 is empty, I will place decrypted opcodes here */
  2707.     ROM_LOAD_EVEN( "13447", 0x080000, 0x20000, 0x70a52167 )
  2708.     ROM_LOAD_ODD ( "13445", 0x080000, 0x20000, 0x28dfc3dd )
  2709.  
  2710.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  2711.     ROM_LOAD( "aurail.a14", 0x00000, 0x20000, 0x0fc4a7a8 ) /* plane 1 */
  2712.     ROM_LOAD( "aurail.b14", 0x20000, 0x20000, 0xe08135e0 )
  2713.     ROM_LOAD( "aurail.a15", 0x40000, 0x20000, 0x1c49852f ) /* plane 2 */
  2714.     ROM_LOAD( "aurail.b15", 0x60000, 0x20000, 0xe14c6684 )
  2715.     ROM_LOAD( "aurail.a16", 0x80000, 0x20000, 0x047bde5e ) /* plane 3 */
  2716.     ROM_LOAD( "aurail.b16", 0xa0000, 0x20000, 0x6309fec4 )
  2717.  
  2718.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  2719.     ROM_LOAD( "aurail.b1",  0x000000, 0x020000, 0x5fa0a9f8 )
  2720.     ROM_LOAD( "aurail.b5",  0x020000, 0x020000, 0x0d1b54da )
  2721.     ROM_LOAD( "aurail.b2",  0x040000, 0x020000, 0x5f6b33b1 )
  2722.     ROM_LOAD( "aurail.b6",  0x060000, 0x020000, 0xbad340c3 )
  2723.     ROM_LOAD( "aurail.b3",  0x080000, 0x020000, 0x4e80520b )
  2724.     ROM_LOAD( "aurail.b7",  0x0a0000, 0x020000, 0x7e9165ac )
  2725.     ROM_LOAD( "aurail.b4",  0x0c0000, 0x020000, 0x5733c428 )
  2726.     ROM_LOAD( "aurail.b8",  0x0e0000, 0x020000, 0x66b8f9b3 )
  2727.     ROM_LOAD( "aurail.a1",  0x100000, 0x020000, 0x4f370b2b )
  2728.     ROM_LOAD( "aurail.b10", 0x120000, 0x020000, 0xf76014bf )
  2729.     ROM_LOAD( "aurail.a2",  0x140000, 0x020000, 0x37cf9cb4 )
  2730.     ROM_LOAD( "aurail.b11", 0x160000, 0x020000, 0x1061e7da )
  2731.     ROM_LOAD( "aurail.a3",  0x180000, 0x020000, 0x049698ef )
  2732.     ROM_LOAD( "aurail.b12", 0x1a0000, 0x020000, 0x7dbcfbf1 )
  2733.     ROM_LOAD( "aurail.a4",  0x1c0000, 0x020000, 0x77a8989e )
  2734.     ROM_LOAD( "aurail.b13", 0x1e0000, 0x020000, 0x551df422 )
  2735.  
  2736.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  2737.     ROM_LOAD( "13448",      0x0000, 0x8000, 0xb5183fb9 )
  2738.     ROM_LOAD( "aurail.a12", 0x10000,0x20000, 0xd3d9aaf9 )
  2739.     ROM_LOAD( "aurail.a12", 0x30000,0x20000, 0xd3d9aaf9 )
  2740. ROM_END
  2741.  
  2742.  
  2743. /***************************************************************************/
  2744.  
  2745. static READ_HANDLER( aurail_skip_r )
  2746. {
  2747.     if (cpu_get_pc()==0xe4e) {cpu_spinuntil_int(); return 0;}
  2748.  
  2749.     return READ_WORD(&sys16_workingram[0x274e]);
  2750. }
  2751.  
  2752. static struct MemoryReadAddress aurail_readmem[] =
  2753. {
  2754.     { 0x000000, 0x0bffff, MRA_ROM },
  2755.     { 0x3f0000, 0x3fffff, MRA_EXTRAM },
  2756.     { 0x400000, 0x40ffff, MRA_TILERAM },
  2757.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  2758.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  2759.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  2760.     { 0xc41002, 0xc41003, io_player1_r },
  2761.     { 0xc41006, 0xc41007, io_player2_r },
  2762.     { 0xc41000, 0xc41001, io_service_r },
  2763.     { 0xc42002, 0xc42003, io_dip1_r },
  2764.     { 0xc42000, 0xc42001, io_dip2_r },
  2765.     { 0xc40000, 0xc4ffff, MRA_EXTRAM2 },
  2766.     { 0xfc0000, 0xfc0fff, MRA_EXTRAM3 },
  2767.     { 0xffe74e, 0xffe74f, aurail_skip_r },
  2768.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  2769.     {-1}
  2770. };
  2771.  
  2772. static struct MemoryWriteAddress aurail_writemem[] =
  2773. {
  2774.     { 0x000000, 0x0bffff, MWA_ROM },
  2775.     { 0x3f0000, 0x3fffff, MWA_EXTRAM },
  2776.     { 0x400000, 0x40ffff, MWA_TILERAM },
  2777.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  2778.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  2779.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  2780.     { 0xc40000, 0xc4ffff, MWA_EXTRAM2 },
  2781.     { 0xfc0000, 0xfc0fff, MWA_EXTRAM3 },
  2782.     { 0xfe0006, 0xfe0007, sound_command_w },
  2783.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  2784.     {-1}
  2785. };
  2786. /***************************************************************************/
  2787.  
  2788. static void aurail_update_proc (void)
  2789. {
  2790.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  2791.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  2792.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  2793.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  2794.  
  2795.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  2796.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  2797.  
  2798.     set_tile_bank( READ_WORD( &sys16_extraram3[0x0002] ) );
  2799.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  2800. }
  2801.  
  2802. static void aurail_init_machine( void ){
  2803.     static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
  2804.  
  2805.     sys16_obj_bank = bank;
  2806.     sys16_spritesystem = 4;
  2807.     sys16_spritelist_end=0x8000;
  2808.     sys16_bg_priority_mode=1;
  2809.  
  2810.     sys16_update_proc = aurail_update_proc;
  2811. }
  2812.  
  2813. static void init_aurail (void)
  2814. {
  2815.     sys16_onetime_init_machine();
  2816.     sys16_sprite_decode (8,0x40000);
  2817. }
  2818.  
  2819. static void init_auraila(void)
  2820. {
  2821.     unsigned char *rom = memory_region(REGION_CPU1);
  2822.     int diff = 0x40000;    /* place decrypted opcodes in a empty hole */
  2823.  
  2824.     init_aurail();
  2825.  
  2826.     memory_set_opcode_base(0,rom+diff);
  2827.  
  2828.     memcpy(rom+diff,rom,0x40000);
  2829.  
  2830.     aurail_decode_data(rom,rom,0x10000);
  2831.     aurail_decode_opcode1(rom+diff,rom+diff,0x10000);
  2832.     aurail_decode_opcode2(rom+diff+0x10000,rom+diff+0x10000,0x10000);
  2833. }
  2834.  
  2835. /***************************************************************************/
  2836.  
  2837. INPUT_PORTS_START( aurail )
  2838.     SYS16_JOY1
  2839.     SYS16_JOY2
  2840.     SYS16_SERVICE
  2841.     SYS16_COINAGE
  2842.  
  2843. PORT_START    /* DSW1 */
  2844.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
  2845.     PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
  2846.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  2847.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  2848.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  2849.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2850.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  2851.     PORT_DIPSETTING(    0x00, "2" )
  2852.     PORT_DIPSETTING(    0x0c, "3" )
  2853.     PORT_DIPSETTING(    0x08, "4" )
  2854.     PORT_DIPSETTING(    0x04, "5" )
  2855.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )
  2856.     PORT_DIPSETTING(    0x10, "Normal" )
  2857.     PORT_DIPSETTING(    0x00, "Hard" )
  2858.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Difficulty ) )
  2859.     PORT_DIPSETTING(    0x20, "Normal" )
  2860.     PORT_DIPSETTING(    0x00, "Hard" )
  2861.     PORT_DIPNAME( 0x40, 0x40, "Controller select" )
  2862.     PORT_DIPSETTING(    0x40, "1 Player side" )
  2863.     PORT_DIPSETTING(    0x00, "2 Players side" )
  2864.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
  2865.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  2866.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  2867. INPUT_PORTS_END
  2868.  
  2869. /***************************************************************************/
  2870.  
  2871. MACHINE_DRIVER_7759( machine_driver_aurail, \
  2872.     aurail_readmem,aurail_writemem,aurail_init_machine, gfx4,upd7759_interface )
  2873.  
  2874. /***************************************************************************/
  2875. // sys16B
  2876. ROM_START( bayroute )
  2877.     ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
  2878.     ROM_LOAD_EVEN( "br.4a", 0x000000, 0x10000, 0x91c6424b )
  2879.     ROM_LOAD_ODD ( "br.1a", 0x000000, 0x10000, 0x76954bf3 )
  2880.     /* empty 0x20000-0x80000*/
  2881.     ROM_LOAD_EVEN( "br.5a", 0x080000, 0x10000, 0x9d6fd183 )
  2882.     ROM_LOAD_ODD ( "br.2a", 0x080000, 0x10000, 0x5ca1e3d2 )
  2883.     ROM_LOAD_EVEN( "br.6a", 0x0a0000, 0x10000, 0xed97ad4c )
  2884.     ROM_LOAD_ODD ( "br.3a", 0x0a0000, 0x10000, 0x0d362905 )
  2885.  
  2886.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  2887.     ROM_LOAD( "opr12462.a14", 0x00000, 0x10000, 0xa19943b5 )
  2888.     ROM_LOAD( "opr12463.a15", 0x10000, 0x10000, 0x62f8200d )
  2889.     ROM_LOAD( "opr12464.a16", 0x20000, 0x10000, 0xc8c59703 )
  2890.  
  2891.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  2892.     ROM_LOAD( "br_obj0o.1b", 0x00000, 0x10000, 0x098a5e82 )
  2893.     ROM_LOAD( "br_obj0e.5b", 0x10000, 0x10000, 0x85238af9 )
  2894.     ROM_LOAD( "br_obj1o.2b", 0x20000, 0x10000, 0xcc641da1 )
  2895.     ROM_LOAD( "br_obj1e.6b", 0x30000, 0x10000, 0xd3123315 )
  2896.     ROM_LOAD( "br_obj2o.3b", 0x40000, 0x10000, 0x84efac1f )
  2897.     ROM_LOAD( "br_obj2e.7b", 0x50000, 0x10000, 0xb73b12cb )
  2898.     ROM_LOAD( "br_obj3o.4b", 0x60000, 0x10000, 0xa2e238ac )
  2899.     ROM_LOAD( "br.8b",         0x70000, 0x10000, 0xd8de78ff )
  2900.  
  2901.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  2902.     ROM_LOAD( "epr12459.a10", 0x00000, 0x08000, 0x3e1d29d0 )
  2903.     ROM_LOAD( "mpr12460.a11", 0x10000, 0x20000, 0x0bae570d )
  2904.     ROM_LOAD( "mpr12461.a12", 0x30000, 0x20000, 0xb03b8b46 )
  2905. ROM_END
  2906.  
  2907. ROM_START( bayrouta )
  2908.     ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
  2909. // custom cpu 317-0116
  2910.     ROM_LOAD_EVEN( "epr12517.a7", 0x000000, 0x20000, 0x436728a9 )
  2911.     ROM_LOAD_ODD ( "epr12516.a5", 0x000000, 0x20000, 0x4ff0353f )
  2912.     /* empty 0x40000-0x80000*/
  2913.     ROM_LOAD_EVEN( "epr12458.a8", 0x080000, 0x20000, 0xe7c7476a )
  2914.     ROM_LOAD_ODD ( "epr12456.a6", 0x080000, 0x20000, 0x25dc2eaf )
  2915.  
  2916.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  2917.     ROM_LOAD( "opr12462.a14", 0x00000, 0x10000, 0xa19943b5 )
  2918.     ROM_LOAD( "opr12463.a15", 0x10000, 0x10000, 0x62f8200d )
  2919.     ROM_LOAD( "opr12464.a16", 0x20000, 0x10000, 0xc8c59703 )
  2920.  
  2921.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  2922.     ROM_LOAD( "mpr12465.b1", 0x00000, 0x20000, 0x11d61b45 )
  2923.     ROM_LOAD( "mpr12467.b5", 0x20000, 0x20000, 0xc3b4e4c0 )
  2924.     ROM_LOAD( "mpr12466.b2", 0x40000, 0x20000, 0xa57f236f )
  2925.     ROM_LOAD( "mpr12468.b6", 0x60000, 0x20000, 0xd89c77de )
  2926.  
  2927.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  2928.     ROM_LOAD( "epr12459.a10", 0x00000, 0x08000, 0x3e1d29d0 )
  2929.     ROM_LOAD( "mpr12460.a11", 0x10000, 0x20000, 0x0bae570d )
  2930.     ROM_LOAD( "mpr12461.a12", 0x30000, 0x20000, 0xb03b8b46 )
  2931. ROM_END
  2932.  
  2933. ROM_START( bayrtbl1 )
  2934.     ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
  2935.     ROM_LOAD_EVEN( "b4.bin", 0x000000, 0x10000, 0xeb6646ae )
  2936.     ROM_LOAD_ODD ( "b2.bin", 0x000000, 0x10000, 0xecd9cd0e )
  2937.     /* empty 0x20000-0x80000*/
  2938.     ROM_LOAD_EVEN( "br.5a",  0x080000, 0x10000, 0x9d6fd183 )
  2939.     ROM_LOAD_ODD ( "br.2a",  0x080000, 0x10000, 0x5ca1e3d2 )
  2940.     ROM_LOAD_EVEN( "b8.bin", 0x0a0000, 0x10000, 0xe7ca0331 )
  2941.     ROM_LOAD_ODD ( "b6.bin", 0x0a0000, 0x10000, 0x2bc748a6 )
  2942.  
  2943.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  2944.     ROM_LOAD( "bs16.bin", 0x00000, 0x10000, 0xa8a5b310 )
  2945.     ROM_LOAD( "bs14.bin", 0x10000, 0x10000, 0x6bc4d0a8 )
  2946.     ROM_LOAD( "bs12.bin", 0x20000, 0x10000, 0xc1f967a6 )
  2947.  
  2948.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  2949.     ROM_LOAD( "br_obj0o.1b", 0x00000, 0x10000, 0x098a5e82 )
  2950.     ROM_LOAD( "br_obj0e.5b", 0x10000, 0x10000, 0x85238af9 )
  2951.     ROM_LOAD( "br_obj1o.2b", 0x20000, 0x10000, 0xcc641da1 )
  2952.     ROM_LOAD( "br_obj1e.6b", 0x30000, 0x10000, 0xd3123315 )
  2953.     ROM_LOAD( "br_obj2o.3b", 0x40000, 0x10000, 0x84efac1f )
  2954.     ROM_LOAD( "br_obj2e.7b", 0x50000, 0x10000, 0xb73b12cb )
  2955.     ROM_LOAD( "br_obj3o.4b", 0x60000, 0x10000, 0xa2e238ac )
  2956.     ROM_LOAD( "bs7.bin",     0x70000, 0x10000, 0x0c91abcc )
  2957.  
  2958.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  2959.     ROM_LOAD( "epr12459.a10", 0x00000, 0x08000, 0x3e1d29d0 )
  2960.     ROM_LOAD( "mpr12460.a11", 0x10000, 0x20000, 0x0bae570d )
  2961.     ROM_LOAD( "mpr12461.a12", 0x30000, 0x20000, 0xb03b8b46 )
  2962. ROM_END
  2963.  
  2964. ROM_START( bayrtbl2 )
  2965.     ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
  2966.     ROM_LOAD_EVEN( "br_04", 0x000000, 0x10000, 0x2e33ebfc )
  2967.     ROM_LOAD_ODD ( "br_06", 0x000000, 0x10000, 0x3db42313 )
  2968.     /* empty 0x20000-0x80000*/
  2969.     ROM_LOAD_EVEN( "br_03", 0x080000, 0x20000, 0x285d256b )
  2970.     ROM_LOAD_ODD ( "br_05", 0x080000, 0x20000, 0x552e6384 )
  2971.  
  2972.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  2973.     ROM_LOAD( "br_15",    0x00000, 0x10000, 0x050079a9 )
  2974.     ROM_LOAD( "br_16",    0x10000, 0x10000, 0xfc371928 )
  2975.     ROM_LOAD( "bs12.bin", 0x20000, 0x10000, 0xc1f967a6 )
  2976.  
  2977.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  2978.     ROM_LOAD( "br_11",       0x00000, 0x10000, 0x65232905 )
  2979.     ROM_LOAD( "br_obj0e.5b", 0x10000, 0x10000, 0x85238af9 )
  2980.     ROM_LOAD( "br_obj1o.2b", 0x20000, 0x10000, 0xcc641da1 )
  2981.     ROM_LOAD( "br_obj1e.6b", 0x30000, 0x10000, 0xd3123315 )
  2982.     ROM_LOAD( "br_obj2o.3b", 0x40000, 0x10000, 0x84efac1f )
  2983.     ROM_LOAD( "br_09",       0x50000, 0x10000, 0x05e9b840 )
  2984.     ROM_LOAD( "br_14",       0x60000, 0x10000, 0x4c4a177b )
  2985.     ROM_LOAD( "bs7.bin",     0x70000, 0x10000, 0x0c91abcc )
  2986.  
  2987.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  2988.     ROM_LOAD( "br_01", 0x00000, 0x10000, 0xb87156ec )
  2989.     ROM_LOAD( "br_02", 0x10000, 0x10000, 0xef63991b )
  2990. ROM_END
  2991.  
  2992. /***************************************************************************/
  2993.  
  2994. static struct MemoryReadAddress bayroute_readmem[] =
  2995. {
  2996.     { 0x000000, 0x0bffff, MRA_ROM },
  2997.     { 0x500000, 0x503fff, MRA_EXTRAM3 },
  2998.     { 0x600000, 0x600fff, MRA_SPRITERAM },
  2999.     { 0x700000, 0x70ffff, MRA_TILERAM },
  3000.     { 0x710000, 0x710fff, MRA_TEXTRAM },
  3001.     { 0x800000, 0x800fff, MRA_PALETTERAM },
  3002.     { 0x901002, 0x901003, io_player1_r },
  3003.     { 0x901006, 0x901007, io_player2_r },
  3004.     { 0x901000, 0x901001, io_service_r },
  3005.     { 0x902002, 0x902003, io_dip1_r },
  3006.     { 0x902000, 0x902001, io_dip2_r },
  3007.     { 0x900000, 0x900fff, MRA_EXTRAM2 },
  3008.  
  3009.     {-1}
  3010. };
  3011.  
  3012. static struct MemoryWriteAddress bayroute_writemem[] =
  3013. {
  3014.     { 0x000000, 0x0bffff, MWA_ROM },
  3015.     { 0x500000, 0x503fff, MWA_EXTRAM3 },
  3016.     { 0x600000, 0x600fff, MWA_SPRITERAM },
  3017.     { 0x700000, 0x70ffff, MWA_TILERAM },
  3018.     { 0x710000, 0x710fff, MWA_TEXTRAM },
  3019.     { 0x800000, 0x800fff, MWA_PALETTERAM },
  3020.     { 0x900000, 0x900fff, MWA_EXTRAM2 },
  3021.     { 0xff0006, 0xff0007, sound_command_w },
  3022.  
  3023.     {-1}
  3024. };
  3025.  
  3026. /***************************************************************************/
  3027.  
  3028. static void bayroute_update_proc( void ){
  3029.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  3030.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  3031.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  3032.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  3033.  
  3034.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  3035.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  3036.  
  3037.     set_refresh( READ_WORD( &sys16_extraram2[0x0] ) );
  3038. }
  3039.  
  3040. static void bayroute_init_machine( void ){
  3041.     static int bank[16] = { 0,0,0,0,0,0,0,6,0,0,0,4,0,2,0,0 };
  3042.     sys16_obj_bank = bank;
  3043.     sys16_update_proc = bayroute_update_proc;
  3044.     sys16_spritesystem = 4;
  3045.     sys16_spritelist_end=0xc000;
  3046. }
  3047.  
  3048. static void init_bayroute( void )
  3049. {
  3050.     sys16_onetime_init_machine();
  3051.     sys16_sprite_decode( 4,0x20000 );
  3052. }
  3053.  
  3054. static void init_bayrouta( void )
  3055. {
  3056.     sys16_onetime_init_machine();
  3057.     sys16_sprite_decode( 2,0x40000 );
  3058. }
  3059.  
  3060. static void init_bayrtbl1( void )
  3061. {
  3062.     int i;
  3063.  
  3064.     sys16_onetime_init_machine();
  3065.  
  3066.     /* invert the graphics bits on the tiles */
  3067.     for (i = 0; i < 0x30000; i++)
  3068.         memory_region(REGION_GFX1)[i] ^= 0xff;
  3069.  
  3070.     sys16_sprite_decode( 4,0x20000 );
  3071. }
  3072. /***************************************************************************/
  3073.  
  3074. INPUT_PORTS_START( bayroute )
  3075.     SYS16_JOY1
  3076.     SYS16_JOY2
  3077.     SYS16_SERVICE
  3078.     SYS16_COINAGE
  3079.  
  3080. PORT_START
  3081.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  3082.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  3083.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3084.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  3085.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  3086.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3087.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  3088.     PORT_DIPSETTING(    0x04, "1" )
  3089.     PORT_DIPSETTING(    0x0c, "3" )
  3090.     PORT_DIPSETTING(    0x08, "5" )
  3091.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Unlimited", IP_KEY_NONE, IP_JOY_NONE )
  3092.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) )
  3093.     PORT_DIPSETTING(    0x30, "10000" )
  3094.     PORT_DIPSETTING(    0x20, "15000" )
  3095.     PORT_DIPSETTING(    0x10, "20000" )
  3096.     PORT_DIPSETTING(    0x00, "None" )
  3097.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Unknown ) )
  3098.     PORT_DIPSETTING(    0xc0, "A" )
  3099.     PORT_DIPSETTING(    0x80, "B" )
  3100.     PORT_DIPSETTING(    0x40, "C" )
  3101.     PORT_DIPSETTING(    0x00, "D" )
  3102.  
  3103. INPUT_PORTS_END
  3104.  
  3105. /***************************************************************************/
  3106.  
  3107. MACHINE_DRIVER_7759( machine_driver_bayroute, \
  3108.     bayroute_readmem,bayroute_writemem,bayroute_init_machine, gfx1,upd7759_interface )
  3109.  
  3110. /***************************************************************************
  3111.  
  3112.    Body Slam
  3113.  
  3114. ***************************************************************************/
  3115. // pre16
  3116. ROM_START( bodyslam )
  3117.     ROM_REGION( 0x30000, REGION_CPU1 ) /* 68000 code */
  3118.     ROM_LOAD_EVEN( "epr10066.b9", 0x000000, 0x8000, 0x6cd53290 )
  3119.     ROM_LOAD_ODD ( "epr10063.b6", 0x000000, 0x8000, 0xdd849a16 )
  3120.     ROM_LOAD_EVEN( "epr10067.b10",0x010000, 0x8000, 0xdb22a5ce )
  3121.     ROM_LOAD_ODD ( "epr10064.b7", 0x010000, 0x8000, 0x53d6b7e0 )
  3122.     ROM_LOAD_EVEN( "epr10068.b11",0x020000, 0x8000, 0x15ccc665 )
  3123.     ROM_LOAD_ODD ( "epr10065.b8", 0x020000, 0x8000, 0x0e5fa314 )
  3124.  
  3125.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  3126.     ROM_LOAD( "epr10321.c9",  0x00000, 0x8000, 0xcd3e7cba ) /* plane 1 */
  3127.     ROM_LOAD( "epr10322.c10", 0x08000, 0x8000, 0xb53d3217 ) /* plane 2 */
  3128.     ROM_LOAD( "epr10323.c11", 0x10000, 0x8000, 0x915a3e61 ) /* plane 3 */
  3129.  
  3130.     ROM_REGION( 0x50000*2, REGION_GFX2 ) /* sprites */
  3131.     ROM_LOAD( "epr10012.c5",  0x000000, 0x08000, 0x990824e8 )
  3132.     ROM_RELOAD(               0x040000, 0x08000 )
  3133.     ROM_LOAD( "epr10016.b2",  0x008000, 0x08000, 0xaf5dc72f )
  3134.     ROM_RELOAD(               0x048000, 0x08000 )
  3135.     ROM_LOAD( "epr10013.c6",  0x010000, 0x08000, 0x9a0919c5 )
  3136.     ROM_LOAD( "epr10017.b3",  0x018000, 0x08000, 0x62aafd95 )
  3137.     ROM_LOAD( "epr10027.c7",  0x020000, 0x08000, 0x3f1c57c7 )
  3138.     ROM_LOAD( "epr10028.b4",  0x028000, 0x08000, 0x80d4946d )
  3139.     ROM_LOAD( "epr10015.c8",  0x030000, 0x08000, 0x582d3b6a )
  3140.     ROM_LOAD( "epr10019.b5",  0x038000, 0x08000, 0xe020c38b )
  3141.  
  3142.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  3143.     ROM_LOAD( "epr10026.b1", 0x00000, 0x8000, 0x123b69b8 )
  3144.  
  3145.     ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
  3146.     ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
  3147.  
  3148.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
  3149.     ROM_LOAD( "epr10029.c1", 0x00000, 0x8000, 0x7e4aca83 )
  3150.     ROM_LOAD( "epr10030.c2", 0x08000, 0x8000, 0xdcc1df0b )
  3151.     ROM_LOAD( "epr10031.c3", 0x10000, 0x8000, 0xea3c4472 )
  3152.     ROM_LOAD( "epr10032.c4", 0x18000, 0x8000, 0x0aabebce )
  3153.  
  3154. ROM_END
  3155.  
  3156. ROM_START( dumpmtmt )
  3157.     ROM_REGION( 0x30000, REGION_CPU1 ) /* 68000 code */
  3158.     ROM_LOAD_EVEN( "7704a.bin", 0x000000, 0x8000, 0x96de6c7b )
  3159.     ROM_LOAD_ODD ( "7701a.bin", 0x000000, 0x8000, 0x786d1009 )
  3160.     ROM_LOAD_EVEN( "7705a.bin", 0x010000, 0x8000, 0xfc584391 )
  3161.     ROM_LOAD_ODD ( "7702a.bin", 0x010000, 0x8000, 0x2241a8fd )
  3162.     ROM_LOAD_EVEN( "7706a.bin", 0x020000, 0x8000, 0x6bbcc9d0 )
  3163.     ROM_LOAD_ODD ( "7703a.bin", 0x020000, 0x8000, 0xfcb0cd40 )
  3164.  
  3165.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  3166.     ROM_LOAD( "7707a.bin",  0x00000, 0x8000, 0x45318738 ) /* plane 1 */
  3167.     ROM_LOAD( "7708a.bin",  0x08000, 0x8000, 0x411be9a4 ) /* plane 2 */
  3168.     ROM_LOAD( "7709a.bin",  0x10000, 0x8000, 0x74ceb5a8 ) /* plane 3 */
  3169.  
  3170.     ROM_REGION( 0x50000*2, REGION_GFX2 ) /* sprites */
  3171.     ROM_LOAD( "7715.bin",  0x000000, 0x08000, 0xbf47e040 )
  3172.     ROM_RELOAD(               0x040000, 0x08000 )
  3173.     ROM_LOAD( "7719.bin",  0x008000, 0x08000, 0xfa5c5d6c )
  3174.     ROM_RELOAD(               0x048000, 0x08000 )
  3175.     ROM_LOAD( "epr10013.c6",  0x010000, 0x08000, 0x9a0919c5 )    /* 7716 */
  3176.     ROM_LOAD( "epr10017.b3",  0x018000, 0x08000, 0x62aafd95 )    /* 7720 */
  3177.     ROM_LOAD( "7717.bin",  0x020000, 0x08000, 0xfa64c86d )
  3178.     ROM_LOAD( "7721.bin",  0x028000, 0x08000, 0x62a9143e )
  3179.     ROM_LOAD( "epr10015.c8",  0x030000, 0x08000, 0x582d3b6a )    /* 7718 */
  3180.     ROM_LOAD( "epr10019.b5",  0x038000, 0x08000, 0xe020c38b )    /* 7722 */
  3181.  
  3182.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  3183.     ROM_LOAD( "7710a.bin", 0x00000, 0x8000, 0xa19b8ba8 )
  3184.  
  3185.     ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
  3186.     ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
  3187.  
  3188.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
  3189.     ROM_LOAD( "7711.bin", 0x00000, 0x8000, 0xefa9aabd )
  3190.     ROM_LOAD( "7712.bin", 0x08000, 0x8000, 0x7bcd85cf )
  3191.     ROM_LOAD( "7713.bin", 0x10000, 0x8000, 0x33f292e7 )
  3192.     ROM_LOAD( "7714.bin", 0x18000, 0x8000, 0x8fd48c47 )
  3193.  
  3194. ROM_END
  3195.  
  3196. /***************************************************************************/
  3197.  
  3198. static struct MemoryReadAddress bodyslam_readmem[] =
  3199. {
  3200.     { 0x000000, 0x02ffff, MRA_ROM },
  3201.     { 0x400000, 0x40ffff, MRA_TILERAM },
  3202.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  3203.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  3204.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  3205.     { 0xc41002, 0xc41003, io_player1_r },
  3206.     { 0xc41006, 0xc41007, io_player2_r },
  3207.     { 0xc41000, 0xc41001, io_service_r },
  3208.     { 0xc42000, 0xc42001, io_dip1_r },
  3209.     { 0xc42002, 0xc42003, io_dip2_r },
  3210.     { 0xc40000, 0xc400ff, MRA_EXTRAM2 },
  3211.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  3212.     {-1}
  3213. };
  3214.  
  3215. static struct MemoryWriteAddress bodyslam_writemem[] =
  3216. {
  3217.     { 0x000000, 0x02ffff, MWA_ROM },
  3218.     { 0x400000, 0x40ffff, MWA_TILERAM },
  3219.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  3220.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  3221.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  3222.     { 0xc40000, 0xc40001, sound_command_nmi_w },
  3223.     { 0xc40000, 0xc400ff, MWA_EXTRAM2 },
  3224.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  3225.     {-1}
  3226. };
  3227. /***************************************************************************/
  3228.  
  3229. static void bodyslam_update_proc (void)
  3230. {
  3231.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
  3232.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
  3233.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x00ff;
  3234.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x01ff;
  3235.  
  3236.     set_fg_page1( READ_WORD( &sys16_textram[0x0e9e] ) );
  3237.     set_bg_page1( READ_WORD( &sys16_textram[0x0e9c] ) );
  3238.  
  3239.     set_refresh_3d( READ_WORD( &sys16_extraram2[2] ) );
  3240. }
  3241.  
  3242.  
  3243. static void bodyslam_init_machine( void ){
  3244.     static int bank[16] = {0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3};
  3245.     sys16_obj_bank = bank;
  3246.     sys16_textmode=1;
  3247.     sys16_spritesystem = 2;
  3248.     sys16_sprxoffset = -0xbc;
  3249.     sys16_fgxoffset = sys16_bgxoffset = 7;
  3250.     sys16_bg_priority_mode = 2;
  3251.     sys16_bg_priority_value=0x0e00;
  3252.  
  3253.     sys16_textlayer_lo_min=0;
  3254.     sys16_textlayer_lo_max=0x1f;
  3255.     sys16_textlayer_hi_min=0x20;
  3256.     sys16_textlayer_hi_max=0xff;
  3257.  
  3258.     sys16_update_proc = bodyslam_update_proc;
  3259. }
  3260.  
  3261. static void bodyslam_sprite_decode (void)
  3262. {
  3263.     sys16_sprite_decode (5,0x10000);
  3264. }
  3265.  
  3266.  
  3267. // I have no idea if this is needed, but I cannot find any code for the countdown
  3268. // timer in the code and this seems to work ok.
  3269. static void bodyslam_irq_timer(void)
  3270. {
  3271.     int flag=READ_WORD(&sys16_workingram[0x200])>>8;
  3272.     int tick=READ_WORD(&sys16_workingram[0x200])&0xff;
  3273.     int sec=READ_WORD(&sys16_workingram[0x202])>>8;
  3274.     int min=READ_WORD(&sys16_workingram[0x202])&0xff;
  3275.  
  3276.     if(tick == 0 && sec == 0 && min == 0)
  3277.         flag=1;
  3278.     else
  3279.     {
  3280.         if(tick==0)
  3281.         {
  3282.             tick=0x40;    // The game initialise this to 0x40
  3283.             if(sec==0)
  3284.             {
  3285.                 sec=0x59;
  3286.                 if(min==0)
  3287.                 {
  3288.                     flag=1;
  3289.                     tick=sec=min=0;
  3290.                 }
  3291.                 else
  3292.                     min--;
  3293.             }
  3294.             else
  3295.             {
  3296.                 if((sec&0xf)==0)
  3297.                 {
  3298.                     sec-=0x10;
  3299.                     sec|=9;
  3300.                 }
  3301.                 else
  3302.                     sec--;
  3303.  
  3304.             }
  3305.         }
  3306.         else
  3307.             tick--;
  3308.     }
  3309.     WRITE_WORD(&sys16_workingram[0x200],(flag<<8)+tick);
  3310.     WRITE_WORD(&sys16_workingram[0x202],(sec<<8)+min);
  3311. }
  3312.  
  3313. static void init_bodyslam( void ){
  3314.     sys16_onetime_init_machine();
  3315.     sys16_bg1_trans=1;
  3316.     sys16_custom_irq=bodyslam_irq_timer;
  3317.     bodyslam_sprite_decode();
  3318. }
  3319.  
  3320. /***************************************************************************/
  3321.  
  3322. INPUT_PORTS_START( bodyslam )
  3323.     SYS16_JOY1
  3324.     SYS16_JOY2
  3325.     SYS16_SERVICE
  3326.     SYS16_COINAGE
  3327.  
  3328. PORT_START    /* DSW1 */
  3329.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
  3330.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  3331.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3332.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  3333.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  3334.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3335.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  3336.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  3337.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3338.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  3339.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  3340.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3341.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  3342.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  3343.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3344.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  3345.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  3346.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3347.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  3348.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  3349.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3350.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  3351.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  3352.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3353.  
  3354. INPUT_PORTS_END
  3355.  
  3356. /***************************************************************************/
  3357.  
  3358. MACHINE_DRIVER_7751( machine_driver_bodyslam, \
  3359.     bodyslam_readmem,bodyslam_writemem,bodyslam_init_machine, gfx8 )
  3360.  
  3361. /***************************************************************************/
  3362. // sys16B
  3363. ROM_START( dduxbl )
  3364.     ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
  3365.     ROM_LOAD_EVEN( "dduxb03.bin", 0x000000, 0x20000, 0xe7526012 )
  3366.     ROM_LOAD_ODD ( "dduxb05.bin", 0x000000, 0x20000, 0x459d1237 )
  3367.     /* empty 0x40000 - 0x80000 */
  3368.     ROM_LOAD_EVEN( "dduxb02.bin", 0x080000, 0x20000, 0xd8ed3132 )
  3369.     ROM_LOAD_ODD ( "dduxb04.bin", 0x080000, 0x20000, 0x30c6cb92 )
  3370.  
  3371.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  3372.     ROM_LOAD( "dduxb14.bin", 0x00000, 0x10000, 0x664bd135 )
  3373.     ROM_LOAD( "dduxb15.bin", 0x10000, 0x10000, 0xce0d2b30 )
  3374.     ROM_LOAD( "dduxb16.bin", 0x20000, 0x10000, 0x6de95434 )
  3375.  
  3376.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  3377.     ROM_LOAD( "dduxb10.bin", 0x000000, 0x010000, 0x0be3aee5 )
  3378.     ROM_LOAD( "dduxb06.bin", 0x010000, 0x010000, 0xb0079e99 )
  3379.     ROM_LOAD( "dduxb11.bin", 0x020000, 0x010000, 0xcfb2af18 )
  3380.     ROM_LOAD( "dduxb07.bin", 0x030000, 0x010000, 0x0217369c )
  3381.     ROM_LOAD( "dduxb12.bin", 0x040000, 0x010000, 0x28ce9b15 )
  3382.     ROM_LOAD( "dduxb08.bin", 0x050000, 0x010000, 0x8844f336 )
  3383.     ROM_LOAD( "dduxb13.bin", 0x060000, 0x010000, 0xefe57759 )
  3384.     ROM_LOAD( "dduxb09.bin", 0x070000, 0x010000, 0x6b64f665 )
  3385.  
  3386.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  3387.     ROM_LOAD( "dduxb01.bin", 0x0000, 0x8000, 0x0dbef0d7 )
  3388. ROM_END
  3389.  
  3390. /***************************************************************************/
  3391. static READ_HANDLER( dduxbl_skip_r )
  3392. {
  3393.     if (cpu_get_pc()==0x502) {cpu_spinuntil_int(); return 0xffff;}
  3394.  
  3395.     return READ_WORD(&sys16_workingram[0x36e0]);
  3396. }
  3397.  
  3398. static struct MemoryReadAddress dduxbl_readmem[] =
  3399. {
  3400.     { 0x000000, 0x0bffff, MRA_ROM },
  3401.     { 0x400000, 0x40ffff, MRA_TILERAM },
  3402.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  3403.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  3404.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  3405.     { 0xc41002, 0xc41003, io_player1_r },
  3406.     { 0xc41004, 0xc41005, io_player2_r },
  3407.     { 0xc41000, 0xc41001, io_service_r },
  3408.     { 0xc42002, 0xc42003, io_dip1_r },
  3409.     { 0xc42000, 0xc42001, io_dip2_r },
  3410.     { 0xfff6e0, 0xfff6e1, dduxbl_skip_r },
  3411.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  3412.     {-1}
  3413. };
  3414.  
  3415. static struct MemoryWriteAddress dduxbl_writemem[] =
  3416. {
  3417.     { 0x000000, 0x0bffff, MWA_ROM },
  3418.     { 0x400000, 0x40ffff, MWA_TILERAM },
  3419.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  3420.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  3421.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  3422.     { 0xc40006, 0xc40007, sound_command_w },
  3423.     { 0xc40000, 0xc4ffff, MWA_EXTRAM2 },
  3424.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  3425.     {-1}
  3426. };
  3427. /***************************************************************************/
  3428.  
  3429. static void dduxbl_update_proc( void ){
  3430.     sys16_fg_scrollx = (READ_WORD( &sys16_extraram2[0x6018] ) ^ 0xffff) & 0x01ff;
  3431.     sys16_bg_scrollx = (READ_WORD( &sys16_extraram2[0x6008] ) ^ 0xffff) & 0x01ff;
  3432.     sys16_fg_scrolly = READ_WORD( &sys16_extraram2[0x6010] ) & 0x00ff;
  3433.     sys16_bg_scrolly = READ_WORD( &sys16_extraram2[0x6000] );
  3434.  
  3435.     {
  3436.         unsigned char lu = READ_WORD( &sys16_extraram2[0x6020] ) & 0xff;
  3437.         unsigned char ru = READ_WORD( &sys16_extraram2[0x6022] ) & 0xff;
  3438.         unsigned char ld = READ_WORD( &sys16_extraram2[0x6024] ) & 0xff;
  3439.         unsigned char rd = READ_WORD( &sys16_extraram2[0x6026] ) & 0xff;
  3440.  
  3441.         if (lu==4 && ld==4 && ru==5 && rd==5)
  3442.         { // fix a bug in chicago round (un-tested in MAME)
  3443.             int vs=READ_WORD(&sys16_workingram[0x36ec]);
  3444.             sys16_bg_scrolly = vs & 0xff;
  3445.             sys16_fg_scrolly = vs & 0xff;
  3446.             if (vs >= 0x100)
  3447.             {
  3448.                 lu=0x26; ru=0x37;
  3449.                 ld=0x04; rd=0x15;
  3450.             } else {
  3451.                 ld=0x26; rd=0x37;
  3452.                 lu=0x04; ru=0x15;
  3453.             }
  3454.         }
  3455.         sys16_fg_page[0] = ld&0xf;
  3456.         sys16_fg_page[1] = rd&0xf;
  3457.         sys16_fg_page[2] = lu&0xf;
  3458.         sys16_fg_page[3] = ru&0xf;
  3459.  
  3460.         sys16_bg_page[0] = ld>>4;
  3461.         sys16_bg_page[1] = rd>>4;
  3462.         sys16_bg_page[2] = lu>>4;
  3463.         sys16_bg_page[3] = ru>>4;
  3464.     }
  3465.  
  3466.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  3467. }
  3468.  
  3469. static void dduxbl_init_machine( void ){
  3470.     static int bank[16] = {00,00,00,00,00,00,00,0x06,00,00,00,0x04,00,0x02,00,00};
  3471.  
  3472.     sys16_obj_bank = bank;
  3473.  
  3474.     patch_code( 0x1eb2e, 0x01 );
  3475.     patch_code( 0x1eb2f, 0x01 );
  3476.     patch_code( 0x1eb3c, 0x00 );
  3477.     patch_code( 0x1eb3d, 0x00 );
  3478.     patch_code( 0x23132, 0x01 );
  3479.     patch_code( 0x23133, 0x01 );
  3480.     patch_code( 0x23140, 0x00 );
  3481.     patch_code( 0x23141, 0x00 );
  3482.     patch_code( 0x24a9a, 0x01 );
  3483.     patch_code( 0x24a9b, 0x01 );
  3484.     patch_code( 0x24aa8, 0x00 );
  3485.     patch_code( 0x24aa9, 0x00 );
  3486.  
  3487.     sys16_update_proc = dduxbl_update_proc;
  3488.     sys16_sprxoffset = -0x48;
  3489. }
  3490.  
  3491. static void init_dduxbl(void)
  3492. {
  3493.     int i;
  3494.  
  3495.     sys16_onetime_init_machine();
  3496.  
  3497.     /* invert the graphics bits on the tiles */
  3498.     for (i = 0; i < 0x30000; i++)
  3499.         memory_region(REGION_GFX1)[i] ^= 0xff;
  3500.  
  3501.     sys16_sprite_decode( 4,0x020000 );
  3502. }
  3503. /***************************************************************************/
  3504.  
  3505. INPUT_PORTS_START( dduxbl )
  3506.     SYS16_JOY1
  3507.     SYS16_JOY2
  3508.     SYS16_SERVICE
  3509.     SYS16_COINAGE
  3510.  
  3511. PORT_START    /* DSW1 */
  3512.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
  3513.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  3514.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3515.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
  3516.     PORT_DIPSETTING(    0x04, "Easy" )
  3517.     PORT_DIPSETTING(    0x06, "Normal" )
  3518.     PORT_DIPSETTING(    0x02, "Hard" )
  3519.     PORT_DIPSETTING(    0x00, "Hardest" )
  3520.     PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) )
  3521.     PORT_DIPSETTING(    0x10, "2" )
  3522.     PORT_DIPSETTING(    0x18, "3" )
  3523.     PORT_DIPSETTING(    0x08, "4" )
  3524.     PORT_DIPSETTING(    0x00, "5" )
  3525.     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Bonus_Life ) )
  3526.     PORT_DIPSETTING(    0x40, "150000" )
  3527.     PORT_DIPSETTING(    0x60, "200000" )
  3528.     PORT_DIPSETTING(    0x20, "300000" )
  3529.     PORT_DIPSETTING(    0x00, "400000" )
  3530.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
  3531.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  3532.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3533.  
  3534. INPUT_PORTS_END
  3535.  
  3536. /***************************************************************************/
  3537.  
  3538. MACHINE_DRIVER( machine_driver_dduxbl, \
  3539.     dduxbl_readmem,dduxbl_writemem,dduxbl_init_machine, gfx1)
  3540.  
  3541. /***************************************************************************/
  3542. // sys16B
  3543. ROM_START( eswat )
  3544.     ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
  3545.     ROM_LOAD_EVEN( "12657", 0x000000, 0x40000, 0xcfb935e9 )
  3546.     ROM_LOAD_ODD ( "12656", 0x000000, 0x40000, 0xbe3f9d28 )
  3547.  
  3548.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  3549.     ROM_LOAD( "e12624r", 0x00000, 0x40000, 0xe7b8545e )
  3550.     ROM_LOAD( "e12625r", 0x40000, 0x40000, 0xb418582c )
  3551.     ROM_LOAD( "e12626r", 0x80000, 0x40000, 0xba65789b )
  3552.  
  3553.     ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
  3554.     ROM_LOAD( "e12618r", 0x000000, 0x040000, 0x2d9ae975 )
  3555.     ROM_LOAD( "e12621r", 0x040000, 0x040000, 0x1e6c4cf7 )
  3556.     ROM_LOAD( "e12619r", 0x080000, 0x040000, 0x5f7ee6f6 )
  3557.     ROM_LOAD( "e12622r", 0x0c0000, 0x040000, 0x33251fde )
  3558.     ROM_LOAD( "e12620r", 0x100000, 0x040000, 0x905f9be2 )
  3559.     ROM_LOAD( "e12623r", 0x140000, 0x040000, 0xa25ea1fc )
  3560.  
  3561.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  3562.     ROM_LOAD( "e12617", 0x00000, 0x08000, 0x537930cb )
  3563.     ROM_LOAD( "e12616r",0x10000, 0x20000, 0xf213fa4a )
  3564. ROM_END
  3565.  
  3566. ROM_START( eswatbl )
  3567.     ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
  3568.     ROM_LOAD_EVEN( "eswat_c.rom", 0x000000, 0x10000, 0x1028cc81 )
  3569.     ROM_LOAD_ODD ( "eswat_f.rom", 0x000000, 0x10000, 0xf7b2d388 )
  3570.     ROM_LOAD_EVEN( "eswat_b.rom", 0x020000, 0x10000, 0x87c6b1b5 )
  3571.     ROM_LOAD_ODD ( "eswat_e.rom", 0x020000, 0x10000, 0x937ddf9a )
  3572.     ROM_LOAD_EVEN( "eswat_a.rom", 0x040000, 0x08000, 0x2af4fc62 )
  3573.     ROM_LOAD_ODD ( "eswat_d.rom", 0x040000, 0x08000, 0xb4751e19 )
  3574.  
  3575.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  3576.     ROM_LOAD( "ic19.bin", 0x00000, 0x40000, 0x375a5ec4 )
  3577.     ROM_LOAD( "ic20.bin", 0x40000, 0x40000, 0x3b8c757e )
  3578.     ROM_LOAD( "ic21.bin", 0x80000, 0x40000, 0x3efca25c )
  3579.  
  3580.     ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
  3581.     ROM_LOAD( "ic9.bin",  0x000000, 0x040000, 0x0d1530bf )
  3582.     ROM_LOAD( "ic12.bin", 0x040000, 0x040000, 0x18ff0799 )
  3583.     ROM_LOAD( "ic10.bin", 0x080000, 0x040000, 0x32069246 )
  3584.     ROM_LOAD( "ic13.bin", 0x0c0000, 0x040000, 0xa3dfe436 )
  3585.     ROM_LOAD( "ic11.bin", 0x100000, 0x040000, 0xf6b096e0 )
  3586.     ROM_LOAD( "ic14.bin", 0x140000, 0x040000, 0x6773fef6 )
  3587.  
  3588.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  3589.     ROM_LOAD( "ic8.bin", 0x0000, 0x8000, 0x7efecf23 )
  3590.     ROM_LOAD( "ic6.bin", 0x10000, 0x40000, 0x254347c2 )
  3591. ROM_END
  3592. /***************************************************************************/
  3593.  
  3594. static READ_HANDLER( eswatbl_skip_r )
  3595. {
  3596.     if (cpu_get_pc()==0x65c) {cpu_spinuntil_int(); return 0xffff;}
  3597.  
  3598.     return READ_WORD(&sys16_workingram[0x0454]);
  3599. }
  3600.  
  3601. static struct MemoryReadAddress eswat_readmem[] =
  3602. {
  3603.     { 0x000000, 0x07ffff, MRA_ROM },
  3604.     { 0x400000, 0x40ffff, MRA_TILERAM },
  3605.     { 0x410000, 0x418fff, MRA_TEXTRAM },
  3606.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  3607.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  3608.     { 0xc41002, 0xc41003, io_player1_r },
  3609.     { 0xc41006, 0xc41007, io_player2_r },
  3610.     { 0xc41000, 0xc41001, io_service_r },
  3611.     { 0xc42002, 0xc42003, io_dip1_r },
  3612.     { 0xc42000, 0xc42001, io_dip2_r },
  3613.     { 0xffc454, 0xffc455, eswatbl_skip_r },
  3614.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  3615.     {-1}
  3616. };
  3617.  
  3618. static int eswat_tilebank0;
  3619.  
  3620. static WRITE_HANDLER( eswat_tilebank0_w )
  3621. {
  3622.     eswat_tilebank0 = data;
  3623. }
  3624.  
  3625. static struct MemoryWriteAddress eswat_writemem[] =
  3626. {
  3627.     { 0x000000, 0x07ffff, MWA_ROM },
  3628.     { 0x3e2000, 0x3e2001, eswat_tilebank0_w },
  3629.     { 0x400000, 0x40ffff, MWA_TILERAM },
  3630.     { 0x410000, 0x418fff, MWA_TEXTRAM },
  3631.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  3632.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  3633.     { 0xc42006, 0xc42007, sound_command_w },
  3634.     { 0xc40000, 0xc4ffff, MWA_EXTRAM2 },
  3635.     { 0xc80000, 0xc80001, MWA_NOP },
  3636.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  3637.     {-1}
  3638. };
  3639. /***************************************************************************/
  3640.  
  3641. static void eswat_update_proc( void ){
  3642.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x8008] ) ^ 0xffff;
  3643.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x8018] ) ^ 0xffff;
  3644.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x8000] );
  3645.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x8010] );
  3646.  
  3647.     set_fg_page( READ_WORD( &sys16_textram[0x8020] ) );
  3648.     set_bg_page( READ_WORD( &sys16_textram[0x8028] ) );
  3649.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  3650.  
  3651.     sys16_tile_bank1 = (READ_WORD( &sys16_textram[0x8030] ))&0xf;
  3652.     sys16_tile_bank0 = eswat_tilebank0;
  3653. }
  3654.  
  3655. static void eswat_init_machine( void ){
  3656.     static int bank[16] = { 0,2,8,10,16,18,24,26,4,6,12,14,20,22,28,30};
  3657.  
  3658.     sys16_obj_bank = bank;
  3659.     sys16_sprxoffset = -0x23c;
  3660.  
  3661.     patch_code( 0x3897, 0x11 );
  3662.  
  3663.     sys16_update_proc = eswat_update_proc;
  3664. }
  3665.  
  3666. static void init_eswat( void ){
  3667.     sys16_onetime_init_machine();
  3668.     sys16_rowscroll_scroll=0x8000;
  3669.     sys18_splittab_fg_x=&sys16_textram[0x0f80];
  3670.  
  3671.     sys16_sprite_decode( 3,0x080000 );
  3672. }
  3673.  
  3674. /***************************************************************************/
  3675.  
  3676. INPUT_PORTS_START( eswat )
  3677.     SYS16_JOY1
  3678.     SYS16_JOY2
  3679.     SYS16_SERVICE
  3680.     SYS16_COINAGE
  3681.  
  3682. PORT_START    /* DSW1 */
  3683.     PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
  3684.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  3685.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3686.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  3687.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  3688.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3689.     PORT_DIPNAME( 0x04, 0x04, "Display Flip" )
  3690.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  3691.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3692.     PORT_DIPNAME( 0x08, 0x08, "Time" )
  3693.     PORT_DIPSETTING(    0x08, "Normal" )
  3694.     PORT_DIPSETTING(    0x00, "Hard" )
  3695.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
  3696.     PORT_DIPSETTING(    0x20, "Easy" )
  3697.     PORT_DIPSETTING(    0x30, "Normal" )
  3698.     PORT_DIPSETTING(    0x10, "Hard" )
  3699.     PORT_DIPSETTING(    0x00, "Hardest" )
  3700.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
  3701.     PORT_DIPSETTING(    0x00, "1" )
  3702.     PORT_DIPSETTING(    0x40, "2" )
  3703.     PORT_DIPSETTING(    0xc0, "3" )
  3704.     PORT_DIPSETTING(    0x80, "4" )
  3705. INPUT_PORTS_END
  3706.  
  3707. /***************************************************************************/
  3708.  
  3709. MACHINE_DRIVER_7759( machine_driver_eswat, \
  3710.     eswat_readmem,eswat_writemem,eswat_init_machine, gfx4,upd7759_interface )
  3711.  
  3712. /***************************************************************************/
  3713. // sys16A
  3714. ROM_START( fantzono )
  3715.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  3716.     ROM_LOAD_EVEN( "7385.43", 0x000000, 0x8000, 0x5cb64450 )
  3717.     ROM_LOAD_ODD ( "7382.26", 0x000000, 0x8000, 0x3fda7416 )
  3718.     ROM_LOAD_EVEN( "7386.42", 0x010000, 0x8000, 0x15810ace )
  3719.     ROM_LOAD_ODD ( "7383.25", 0x010000, 0x8000, 0xa001e10a )
  3720.     ROM_LOAD_EVEN( "7387.41", 0x020000, 0x8000, 0x0acd335d )
  3721.     ROM_LOAD_ODD ( "7384.24", 0x020000, 0x8000, 0xfd909341 )
  3722.  
  3723.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  3724.     ROM_LOAD( "7388.95", 0x00000, 0x08000, 0x8eb02f6b )
  3725.     ROM_LOAD( "7389.94", 0x08000, 0x08000, 0x2f4f71b8 )
  3726.     ROM_LOAD( "7390.93", 0x10000, 0x08000, 0xd90609c6 )
  3727.  
  3728.     ROM_REGION( 0x030000*2, REGION_GFX2 ) /* sprites */
  3729.     ROM_LOAD( "7392.10", 0x000000, 0x008000, 0x5bb7c8b6 )
  3730.     ROM_LOAD( "7396.11", 0x008000, 0x008000, 0x74ae4b57 )
  3731.     ROM_LOAD( "7393.17", 0x010000, 0x008000, 0x14fc7e82 )
  3732.     ROM_LOAD( "7397.18", 0x018000, 0x008000, 0xe05a1e25 )
  3733.     ROM_LOAD( "7394.23", 0x020000, 0x008000, 0x531ca13f )
  3734.     ROM_LOAD( "7398.24", 0x028000, 0x008000, 0x68807b49 )
  3735.  
  3736.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  3737.     ROM_LOAD( "7535.12", 0x0000, 0x8000, 0x0cb2126a )
  3738. ROM_END
  3739.  
  3740. ROM_START( fantzone )
  3741.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  3742.     ROM_LOAD_EVEN( "epr7385a.43", 0x000000, 0x8000, 0x4091af42 )
  3743.     ROM_LOAD_ODD ( "epr7382a.26", 0x000000, 0x8000, 0x77d67bfd )
  3744.     ROM_LOAD_EVEN( "epr7386a.42", 0x010000, 0x8000, 0xb0a67cd0 )
  3745.     ROM_LOAD_ODD ( "epr7383a.25", 0x010000, 0x8000, 0x5f79b2a9 )
  3746.     ROM_LOAD_EVEN( "7387.41", 0x020000, 0x8000, 0x0acd335d )
  3747.     ROM_LOAD_ODD ( "7384.24", 0x020000, 0x8000, 0xfd909341 )
  3748.  
  3749.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  3750.     ROM_LOAD( "7388.95", 0x00000, 0x08000, 0x8eb02f6b )
  3751.     ROM_LOAD( "7389.94", 0x08000, 0x08000, 0x2f4f71b8 )
  3752.     ROM_LOAD( "7390.93", 0x10000, 0x08000, 0xd90609c6 )
  3753.  
  3754.     ROM_REGION( 0x030000*2, REGION_GFX2 ) /* sprites */
  3755.     ROM_LOAD( "7392.10", 0x000000, 0x008000, 0x5bb7c8b6 )
  3756.     ROM_LOAD( "7396.11", 0x008000, 0x008000, 0x74ae4b57 )
  3757.     ROM_LOAD( "7393.17", 0x010000, 0x008000, 0x14fc7e82 )
  3758.     ROM_LOAD( "7397.18", 0x018000, 0x008000, 0xe05a1e25 )
  3759.     ROM_LOAD( "7394.23", 0x020000, 0x008000, 0x531ca13f )
  3760.     ROM_LOAD( "7398.24", 0x028000, 0x008000, 0x68807b49 )
  3761.  
  3762.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  3763.     ROM_LOAD( "epr7535a.12", 0x0000, 0x8000, 0xbc1374fa )
  3764. ROM_END
  3765.  
  3766.  
  3767. /***************************************************************************/
  3768.  
  3769. static READ_HANDLER( fantzone_skip_r )
  3770. {
  3771.     if (cpu_get_pc()==0x91b2) {cpu_spinuntil_int(); return 0xffff;}
  3772.  
  3773.     return READ_WORD(&sys16_workingram[0x022a]);
  3774. }
  3775.  
  3776. static struct MemoryReadAddress fantzono_readmem[] =
  3777. {
  3778.     { 0x000000, 0x02ffff, MRA_ROM },
  3779.     { 0x400000, 0x40ffff, MRA_TILERAM },
  3780.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  3781.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  3782.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  3783.     { 0xc41002, 0xc41003, io_player1_r },
  3784.     { 0xc41006, 0xc41007, io_player2_r },
  3785.     { 0xc41000, 0xc41001, io_service_r },
  3786.     { 0xc42000, 0xc42001, io_dip1_r },
  3787.     { 0xc42002, 0xc42003, io_dip2_r },
  3788.     { 0xc40000, 0xc40003, MRA_EXTRAM2 },
  3789.     { 0xffc22a, 0xffc22b, fantzone_skip_r },
  3790.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  3791.     {-1}
  3792. };
  3793.  
  3794. static struct MemoryWriteAddress fantzono_writemem[] =
  3795. {
  3796.     { 0x000000, 0x02ffff, MWA_ROM },
  3797.     { 0x400000, 0x40ffff, MWA_TILERAM },
  3798.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  3799.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  3800.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  3801.     { 0xc40000, 0xc40001, sound_command_nmi_w },
  3802.     { 0xc40000, 0xc40003, MWA_EXTRAM2 },
  3803.     { 0xc60000, 0xc60003, MWA_NOP },
  3804.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  3805.     {-1}
  3806. };
  3807.  
  3808. static struct MemoryReadAddress fantzone_readmem[] =
  3809. {
  3810.     { 0x000000, 0x02ffff, MRA_ROM },
  3811.     { 0x400000, 0x40ffff, MRA_TILERAM },
  3812.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  3813.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  3814.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  3815.     { 0xc41002, 0xc41003, io_player1_r },
  3816.     { 0xc41006, 0xc41007, io_player2_r },
  3817.     { 0xc41000, 0xc41001, io_service_r },
  3818.     { 0xc42000, 0xc42001, io_dip1_r },
  3819.     { 0xc42002, 0xc42003, io_dip2_r },
  3820.     { 0xc40000, 0xc40003, MRA_EXTRAM2 },
  3821.     { 0xffc22a, 0xffc22b, fantzone_skip_r },
  3822.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  3823.     {-1}
  3824. };
  3825.  
  3826. static struct MemoryWriteAddress fantzone_writemem[] =
  3827. {
  3828.     { 0x000000, 0x02ffff, MWA_ROM },
  3829.     { 0x400000, 0x40ffff, MWA_TILERAM },
  3830.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  3831.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  3832.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  3833.     { 0xc40000, 0xc40001, sound_command_nmi_w },
  3834.     { 0xc40000, 0xc40003, MWA_EXTRAM2 },
  3835.     { 0xc60000, 0xc60003, MWA_NOP },
  3836.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  3837.     {-1}
  3838. };
  3839.  
  3840. /***************************************************************************/
  3841.  
  3842. static void fantzone_update_proc( void ){
  3843.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
  3844.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
  3845.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
  3846.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
  3847.  
  3848.     set_fg_page1( READ_WORD( &sys16_textram[0x0e9e] ) );
  3849.     set_bg_page1( READ_WORD( &sys16_textram[0x0e9c] ) );
  3850.  
  3851.     set_refresh_3d( READ_WORD( &sys16_extraram2[2] ) );    // c40003
  3852. }
  3853.  
  3854. static void fantzono_init_machine( void ){
  3855.     static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
  3856.  
  3857.     sys16_obj_bank = bank;
  3858.     sys16_textmode=1;
  3859.     sys16_spritesystem = 3;
  3860.     sys16_sprxoffset = -0xbe;
  3861. //    sys16_fgxoffset = sys16_bgxoffset = 8;
  3862.     sys16_fg_priority_mode=3;                // fixes end of game priority
  3863.     sys16_fg_priority_value=0xd000;
  3864.  
  3865.     patch_code( 0x20e7, 0x16 );
  3866.     patch_code( 0x30ef, 0x16 );
  3867.  
  3868.     // solving Fantasy Zone scrolling bug
  3869.     patch_code(0x308f,0x00);
  3870.  
  3871.     // invincible
  3872. /*    patch_code(0x224e,0x4e);
  3873.     patch_code(0x224f,0x71);
  3874.     patch_code(0x2250,0x4e);
  3875.     patch_code(0x2251,0x71);
  3876.  
  3877.     patch_code(0x2666,0x4e);
  3878.     patch_code(0x2667,0x71);
  3879.     patch_code(0x2668,0x4e);
  3880.     patch_code(0x2669,0x71);
  3881.  
  3882.     patch_code(0x25c0,0x4e);
  3883.     patch_code(0x25c1,0x71);
  3884.     patch_code(0x25c2,0x4e);
  3885.     patch_code(0x25c3,0x71);
  3886. */
  3887.  
  3888.     sys16_update_proc = fantzone_update_proc;
  3889. }
  3890.  
  3891. static void fantzone_init_machine( void ){
  3892.     static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
  3893.  
  3894.     sys16_obj_bank = bank;
  3895.     sys16_textmode=1;
  3896.     sys16_spritesystem = 3;
  3897.     sys16_sprxoffset = -0xbe;
  3898.     sys16_fg_priority_mode=3;                // fixes end of game priority
  3899.     sys16_fg_priority_value=0xd000;
  3900.  
  3901.     patch_code( 0x2135, 0x16 );
  3902.     patch_code( 0x3649, 0x16 );
  3903.  
  3904.     // solving Fantasy Zone scrolling bug
  3905.     patch_code(0x35e9,0x00);
  3906.  
  3907.     sys16_update_proc = fantzone_update_proc;
  3908. }
  3909.  
  3910. static void init_fantzone( void )
  3911. {
  3912.     sys16_onetime_init_machine();
  3913.     sys16_sprite_decode( 3,0x010000 );
  3914. }
  3915. /***************************************************************************/
  3916.  
  3917. INPUT_PORTS_START( fantzone )
  3918.     SYS16_JOY1
  3919.     SYS16_JOY2
  3920.     SYS16_SERVICE
  3921.     SYS16_COINAGE
  3922.  
  3923. PORT_START    /* DSW1 */
  3924.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
  3925.     PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
  3926.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  3927.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  3928.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  3929.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  3930.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  3931.     PORT_DIPSETTING(    0x08, "2" )
  3932.     PORT_DIPSETTING(    0x0c, "3" )
  3933.     PORT_DIPSETTING(    0x04, "4" )
  3934.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "240", IP_KEY_NONE, IP_JOY_NONE )
  3935.     PORT_DIPNAME( 0x30, 0x30, "Extra Ship Cost" )
  3936.     PORT_DIPSETTING(    0x30, "5000" )
  3937.     PORT_DIPSETTING(    0x20, "10000" )
  3938.     PORT_DIPSETTING(    0x10, "15000" )
  3939.     PORT_DIPSETTING(    0x00, "20000" )
  3940.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
  3941.     PORT_DIPSETTING(    0x80, "Easy" )
  3942.     PORT_DIPSETTING(    0xc0, "Normal" )
  3943.     PORT_DIPSETTING(    0x40, "Hard" )
  3944.     PORT_DIPSETTING(    0x00, "Hardest" )
  3945.  
  3946. INPUT_PORTS_END
  3947.  
  3948. /***************************************************************************/
  3949.  
  3950. MACHINE_DRIVER( machine_driver_fantzono, \
  3951.     fantzono_readmem,fantzono_writemem,fantzono_init_machine, gfx8 )
  3952. MACHINE_DRIVER( machine_driver_fantzone, \
  3953.     fantzone_readmem,fantzone_writemem,fantzone_init_machine, gfx8 )
  3954.  
  3955. /***************************************************************************/
  3956. // sys16B
  3957. ROM_START( fpoint )
  3958.     ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
  3959.     ROM_LOAD_EVEN( "12591b.bin", 0x000000, 0x10000, 0x248b3e1b )
  3960.     ROM_LOAD_ODD ( "12590b.bin", 0x000000, 0x10000, 0x75256e3d )
  3961.  
  3962.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  3963.     ROM_LOAD( "12595.bin", 0x00000, 0x10000, 0x5b18d60b )
  3964.     ROM_LOAD( "12594.bin", 0x10000, 0x10000, 0x8bfc4815 )
  3965.     ROM_LOAD( "12593.bin", 0x20000, 0x10000, 0xcc0582d8 )
  3966.  
  3967.     ROM_REGION( 0x020000*2, REGION_GFX2 ) /* sprites */
  3968.     ROM_LOAD( "12596.bin", 0x000000, 0x010000, 0x4a4041f3 )
  3969.     ROM_LOAD( "12597.bin", 0x010000, 0x010000, 0x6961e676 )
  3970.  
  3971.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  3972.     ROM_LOAD( "12592.bin", 0x0000, 0x8000, 0x9a8c11bb )
  3973. ROM_END
  3974.  
  3975. ROM_START( fpointbl )
  3976.     ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
  3977.     ROM_LOAD_EVEN( "flpoint.003", 0x000000, 0x10000, 0x4d6df514 )
  3978.     ROM_LOAD_ODD ( "flpoint.002", 0x000000, 0x10000, 0x4dff2ee8 )
  3979.  
  3980.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  3981.     ROM_LOAD( "flpoint.006", 0x00000, 0x10000, 0xc539727d )
  3982.     ROM_LOAD( "flpoint.005", 0x10000, 0x10000, 0x82c0b8b0 )
  3983.     ROM_LOAD( "flpoint.004", 0x20000, 0x10000, 0x522426ae )
  3984.  
  3985.     ROM_REGION( 0x020000*2, REGION_GFX2 ) /* sprites */
  3986.     ROM_LOAD( "12596.bin", 0x000000, 0x010000, 0x4a4041f3 )
  3987.     ROM_LOAD( "12597.bin", 0x010000, 0x010000, 0x6961e676 )
  3988.  
  3989.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  3990.     ROM_LOAD( "12592.bin",   0x0000, 0x8000, 0x9a8c11bb )    // wrong sound rom? (this ones from the original)
  3991. //    ROM_LOAD( "flpoint.001", 0x0000, 0x8000, 0xc5b8e0fe )    // bootleg rom doesn't work!
  3992. ROM_END
  3993. /***************************************************************************/
  3994.  
  3995. static READ_HANDLER( fp_io_service_dummy_r ){
  3996.     int data = input_port_2_r( 0 ) & 0xff;
  3997.     return (data << 8) + data;
  3998. }
  3999.  
  4000. static struct MemoryReadAddress fpoint_readmem[] =
  4001. {
  4002.     { 0x000000, 0x01ffff, MRA_ROM },
  4003.     { 0x02002e, 0x020049, fp_io_service_dummy_r },
  4004.     { 0x601002, 0x601003, io_player1_r },
  4005.     { 0x601004, 0x601005, io_player2_r },
  4006.     { 0x601000, 0x601001, io_service_r },
  4007.     { 0x600000, 0x600001, io_dip2_r },
  4008.     { 0x600002, 0x600003, io_dip1_r },
  4009.     { 0x400000, 0x40ffff, MRA_TILERAM },
  4010.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  4011.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  4012.     { 0x44302a, 0x44304d, fp_io_service_dummy_r },
  4013.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  4014.     { 0xfe003e, 0xfe003f, fp_io_service_dummy_r },
  4015.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  4016.     {-1}
  4017. };
  4018.  
  4019. static struct MemoryWriteAddress fpoint_writemem[] =
  4020. {
  4021.     { 0x000000, 0x01ffff, MWA_ROM },
  4022.     { 0x600006, 0x600007, sound_command_w },
  4023.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  4024.     { 0x400000, 0x40ffff, MWA_TILERAM },
  4025.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  4026.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  4027.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  4028.     {-1}
  4029. };
  4030. /***************************************************************************/
  4031.  
  4032. static void fpoint_update_proc( void ){
  4033.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  4034.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  4035.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  4036.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  4037.  
  4038.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  4039.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  4040. }
  4041.  
  4042. static void fpoint_init_machine( void ){
  4043.     static int bank[16] = {00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00};
  4044.  
  4045.     sys16_obj_bank = bank;
  4046.  
  4047.     patch_code( 0x454, 0x33 );
  4048.     patch_code( 0x455, 0xf8 );
  4049.     patch_code( 0x456, 0xe0 );
  4050.     patch_code( 0x457, 0xe2 );
  4051.     patch_code( 0x8ce8, 0x16 );
  4052.     patch_code( 0x8ce9, 0x66 );
  4053.     patch_code( 0x17687, 0x00 );
  4054.     patch_code( 0x7bed, 0x04 );
  4055.  
  4056.     patch_code( 0x7ea8, 0x61 );
  4057.     patch_code( 0x7ea9, 0x00 );
  4058.     patch_code( 0x7eaa, 0x84 );
  4059.     patch_code( 0x7eab, 0x16 );
  4060.     patch_code( 0x2c0, 0xe7 );
  4061.     patch_code( 0x2c1, 0x48 );
  4062.     patch_code( 0x2c2, 0xe7 );
  4063.     patch_code( 0x2c3, 0x49 );
  4064.     patch_code( 0x2c4, 0x04 );
  4065.     patch_code( 0x2c5, 0x40 );
  4066.     patch_code( 0x2c6, 0x00 );
  4067.     patch_code( 0x2c7, 0x10 );
  4068.     patch_code( 0x2c8, 0x4e );
  4069.     patch_code( 0x2c9, 0x75 );
  4070.  
  4071.     sys16_update_proc = fpoint_update_proc;
  4072. }
  4073.  
  4074. static void init_fpoint(void)
  4075. {
  4076.     sys16_onetime_init_machine();
  4077.     sys16_sprite_decode( 1,0x020000 );
  4078. }
  4079.  
  4080. static void init_fpointbl(void)
  4081. {
  4082.     int i;
  4083.  
  4084.     sys16_onetime_init_machine();
  4085.  
  4086.     /* invert the graphics bits on the tiles */
  4087.     for (i = 0; i < 0x30000; i++)
  4088.         memory_region(REGION_GFX1)[i] ^= 0xff;
  4089.  
  4090.     sys16_sprite_decode( 1,0x020000 );
  4091. }
  4092. /***************************************************************************/
  4093.  
  4094. INPUT_PORTS_START( fpoint )
  4095. PORT_START
  4096.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
  4097.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 )
  4098.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
  4099.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  4100.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  4101.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  4102.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  4103.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  4104.  
  4105. PORT_START
  4106.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  4107.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
  4108.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  4109.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  4110.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  4111.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  4112.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  4113.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  4114.  
  4115.     SYS16_SERVICE
  4116.     SYS16_COINAGE
  4117.  
  4118. PORT_START    /* DSW1 */
  4119.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  4120.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  4121.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4122.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  4123.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  4124.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4125.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  4126.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  4127.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4128.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  4129.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  4130.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4131.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
  4132.     PORT_DIPSETTING(    0x20, "Easy" )
  4133.     PORT_DIPSETTING(    0x30, "Normal" )
  4134.     PORT_DIPSETTING(    0x10, "Hard" )
  4135.     PORT_DIPSETTING(    0x00, "Hardest" )
  4136.     PORT_DIPNAME( 0x40, 0x40, "Clear round allowed" ) /* Use button 3 */
  4137.     PORT_DIPSETTING(    0x00, "1" )
  4138.     PORT_DIPSETTING(    0x40, "2" )
  4139.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  4140.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  4141.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4142.  
  4143. INPUT_PORTS_END
  4144.  
  4145. /***************************************************************************/
  4146.  
  4147. MACHINE_DRIVER( machine_driver_fpoint, \
  4148.     fpoint_readmem,fpoint_writemem,fpoint_init_machine, gfx1)
  4149.  
  4150. /***************************************************************************/
  4151. // sys16B
  4152. ROM_START( goldnaxe )
  4153.     ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
  4154.     ROM_LOAD_EVEN( "epr12523.a7", 0x00000, 0x20000, 0x8e6128d7 )
  4155.     ROM_LOAD_ODD ( "epr12522.a5", 0x00000, 0x20000, 0xb6c35160 )
  4156.     /* emtpy 0x40000 - 0x80000 */
  4157.     ROM_LOAD_EVEN( "epr12521.a8", 0x80000, 0x20000, 0x5001d713 )
  4158.     ROM_LOAD_ODD ( "epr12519.a6", 0x80000, 0x20000, 0x4438ca8e )
  4159.  
  4160.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  4161.     ROM_LOAD( "epr12385", 0x00000, 0x20000, 0xb8a4e7e0 )
  4162.     ROM_LOAD( "epr12386", 0x20000, 0x20000, 0x25d7d779 )
  4163.     ROM_LOAD( "epr12387", 0x40000, 0x20000, 0xc7fcadf3 )
  4164.  
  4165.     ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
  4166.     ROM_LOAD( "mpr12378.b1", 0x000000, 0x40000, 0x119e5a82 )
  4167.     ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
  4168.     ROM_LOAD( "mpr12380.b2", 0x080000, 0x40000, 0xbb2c0853 )
  4169.     ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
  4170.     ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
  4171.     ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
  4172.  
  4173.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  4174.     ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
  4175.     ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
  4176. ROM_END
  4177.  
  4178. ROM_START( goldnaxj )
  4179.     ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
  4180. // Custom cpu 317-0121
  4181.     ROM_LOAD_EVEN( "epr12540.a7", 0x00000, 0x20000, 0x0c7ccc6d )
  4182.     ROM_LOAD_ODD ( "epr12539.a5", 0x00000, 0x20000, 0x1f24f7d0 )
  4183.     /* emtpy 0x40000 - 0x80000 */
  4184.     ROM_LOAD_EVEN( "epr12521.a8", 0x80000, 0x20000, 0x5001d713 )
  4185.     ROM_LOAD_ODD ( "epr12519.a6", 0x80000, 0x20000, 0x4438ca8e )
  4186.  
  4187.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  4188.     ROM_LOAD( "epr12385", 0x00000, 0x20000, 0xb8a4e7e0 )
  4189.     ROM_LOAD( "epr12386", 0x20000, 0x20000, 0x25d7d779 )
  4190.     ROM_LOAD( "epr12387", 0x40000, 0x20000, 0xc7fcadf3 )
  4191.  
  4192.     ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
  4193.     ROM_LOAD( "mpr12378.b1", 0x000000, 0x40000, 0x119e5a82 )
  4194.     ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
  4195.     ROM_LOAD( "mpr12380.b2", 0x080000, 0x40000, 0xbb2c0853 )
  4196.     ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
  4197.     ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
  4198.     ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
  4199.  
  4200.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  4201.     ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
  4202.     ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
  4203. ROM_END
  4204.  
  4205.  
  4206. ROM_START( goldnabl )
  4207.     ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
  4208. // protected code
  4209.     ROM_LOAD_EVEN( "ga6.a22", 0x00000, 0x10000, 0xf95b459f )
  4210.     ROM_LOAD_ODD ( "ga4.a20", 0x00000, 0x10000, 0x83eabdf5 )
  4211.     ROM_LOAD_EVEN( "ga11.a27",0x20000, 0x10000, 0xf4ef9349 )
  4212.     ROM_LOAD_ODD ( "ga8.a24", 0x20000, 0x10000, 0x37a65839 )
  4213.     /* emtpy 0x40000 - 0x80000 */
  4214.     ROM_LOAD_EVEN( "epr12521.a8", 0x80000, 0x20000, 0x5001d713 )
  4215.     ROM_LOAD_ODD ( "epr12519.a6", 0x80000, 0x20000, 0x4438ca8e )
  4216.  
  4217.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  4218.     ROM_LOAD( "ga33.b16", 0x00000, 0x10000, 0x84587263 )
  4219.     ROM_LOAD( "ga32.b15", 0x10000, 0x10000, 0x63d72388 )
  4220.     ROM_LOAD( "ga31.b14", 0x20000, 0x10000, 0xf8b6ae4f )
  4221.     ROM_LOAD( "ga30.b13", 0x30000, 0x10000, 0xe29baf4f )
  4222.     ROM_LOAD( "ga29.b12", 0x40000, 0x10000, 0x22f0667e )
  4223.     ROM_LOAD( "ga28.b11", 0x50000, 0x10000, 0xafb1a7e4 )
  4224.  
  4225.     ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
  4226.     ROM_LOAD( "ga34.b17", 0x000000, 0x10000, 0x28ba70c8 )
  4227.     ROM_LOAD( "ga35.b18", 0x010000, 0x10000, 0x2ed96a26 )
  4228.     ROM_LOAD( "ga23.a14", 0x020000, 0x10000, 0x84dccc5b )
  4229.     ROM_LOAD( "ga18.a9",  0x030000, 0x10000, 0xde346006 )
  4230.     ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
  4231.     ROM_LOAD( "ga36.b19", 0x080000, 0x10000, 0x101d2fff )
  4232.     ROM_LOAD( "ga37.b20", 0x090000, 0x10000, 0x677e64a6 )
  4233.     ROM_LOAD( "ga19.a10", 0x0a0000, 0x10000, 0x11794d05 )
  4234.     ROM_LOAD( "ga20.a11", 0x0b0000, 0x10000, 0xad1c1c90 )
  4235.     ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
  4236.     ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
  4237.     ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
  4238.  
  4239.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  4240.     ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
  4241.     ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
  4242. ROM_END
  4243.  
  4244.  
  4245. /***************************************************************************/
  4246.  
  4247. static READ_HANDLER( goldnaxe_skip_r )
  4248. {
  4249.     if (cpu_get_pc()==0x3cb0) {cpu_spinuntil_int(); return 0xffff;}
  4250.  
  4251.     return READ_WORD(&sys16_workingram[0x2c1c]);
  4252. }
  4253.  
  4254. static READ_HANDLER( ga_io_players_r ) {return (io_player1_r(offset) << 8) | io_player2_r(offset);}
  4255. static READ_HANDLER( ga_io_service_r )
  4256. {
  4257.     return (io_service_r(offset) << 8) | (READ_WORD(&sys16_workingram[0x2c96]) & 0x00ff);
  4258. }
  4259.  
  4260. static struct MemoryReadAddress goldnaxe_readmem[] =
  4261. {
  4262.     { 0x000000, 0x0bffff, MRA_ROM },
  4263.  
  4264.     { 0x100000, 0x10ffff, MRA_TILERAM },
  4265.     { 0x110000, 0x110fff, MRA_TEXTRAM },
  4266.     { 0x140000, 0x140fff, MRA_PALETTERAM },
  4267.     { 0x1f0000, 0x1f0003, MRA_EXTRAM },
  4268.     { 0x200000, 0x200fff, MRA_SPRITERAM },
  4269.     { 0xc41002, 0xc41003, io_player1_r },
  4270.     { 0xc41006, 0xc41007, io_player2_r },
  4271.     { 0xc41000, 0xc41001, io_service_r },
  4272.     { 0xc42002, 0xc42003, io_dip1_r },
  4273.     { 0xc42000, 0xc42001, io_dip2_r },
  4274.     { 0xc40000, 0xc40fff, MRA_EXTRAM2 },
  4275.     { 0xffecd0, 0xffecd1, ga_io_players_r },
  4276.     { 0xffec96, 0xffec97, ga_io_service_r },
  4277.     { 0xffec1c, 0xffec1d, goldnaxe_skip_r },
  4278.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  4279.     {-1}
  4280. };
  4281.  
  4282. static WRITE_HANDLER( ga_sound_command_w )
  4283. {
  4284.     if( (data&0xff000000)==0 )
  4285.         sound_command_w(offset,data>>8);
  4286.     COMBINE_WORD_MEM(&sys16_workingram[0x2cfc],data);
  4287. }
  4288.  
  4289. static struct MemoryWriteAddress goldnaxe_writemem[] =
  4290. {
  4291.     { 0x000000, 0x0bffff, MWA_ROM },
  4292.     { 0x100000, 0x10ffff, MWA_TILERAM },
  4293.     { 0x110000, 0x110fff, MWA_TEXTRAM },
  4294.     { 0x140000, 0x140fff, MWA_PALETTERAM },
  4295.     { 0x1f0000, 0x1f0003, MWA_EXTRAM },
  4296.     { 0x200000, 0x200fff, MWA_SPRITERAM },
  4297.     { 0xc40000, 0xc40fff, MWA_EXTRAM2 },
  4298.     { 0xc43000, 0xc43001, MWA_NOP },
  4299.     { 0xffecfc, 0xffecfd, ga_sound_command_w },
  4300.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  4301.     {-1}
  4302. };
  4303. /***************************************************************************/
  4304.  
  4305. static void goldnaxe_update_proc( void ){
  4306.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  4307.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  4308.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  4309.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  4310.  
  4311.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  4312.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  4313.     set_tile_bank( READ_WORD( &sys16_workingram[0x2c94] ) );
  4314.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  4315. }
  4316.  
  4317. static void goldnaxe_init_machine( void ){
  4318.     static int bank[16] = { 0,2,8,10,16,18,0,0,4,6,12,14,20,22,0,0 };
  4319.  
  4320.     sys16_obj_bank = bank;
  4321.  
  4322.     patch_code( 0x3CB2, 0x60 );
  4323.     patch_code( 0x3CB3, 0x1e );
  4324.  
  4325.     sys16_sprxoffset = -0xb8;
  4326.     sys16_update_proc = goldnaxe_update_proc;
  4327. }
  4328.  
  4329. static void init_goldnaxe( void )
  4330. {
  4331.     sys16_onetime_init_machine();
  4332.     sys16_sprite_decode( 3,0x80000 );
  4333. }
  4334.  
  4335. static void init_goldnabl( void )
  4336. {
  4337.     int i;
  4338.  
  4339.     sys16_onetime_init_machine();
  4340.  
  4341.     /* invert the graphics bits on the tiles */
  4342.     for (i = 0; i < 0x60000; i++)
  4343.         memory_region(REGION_GFX1)[i] ^= 0xff;
  4344.     sys16_sprite_decode( 3,0x80000 );
  4345. }
  4346.  
  4347. /***************************************************************************/
  4348.  
  4349. INPUT_PORTS_START( goldnaxe )
  4350.     SYS16_JOY1
  4351.     SYS16_JOY2
  4352.     SYS16_SERVICE
  4353.     SYS16_COINAGE
  4354.  
  4355. PORT_START    /* DSW1 */
  4356.     PORT_DIPNAME( 0x01, 0x01, "Credits needed" )
  4357.     PORT_DIPSETTING(    0x01, "1 to start, 1 to continue")
  4358.     PORT_DIPSETTING(    0x00, "2 to start, 1 to continue")
  4359.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  4360.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  4361.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4362.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  4363.     PORT_DIPSETTING(    0x08, "1" )
  4364.     PORT_DIPSETTING(    0x0c, "2" )
  4365.     PORT_DIPSETTING(    0x04, "3" )
  4366.     PORT_DIPSETTING(    0x00, "5" )
  4367.     PORT_DIPNAME( 0x30, 0x30, "Energy Meter" )
  4368.     PORT_DIPSETTING(    0x20, "2" )
  4369.     PORT_DIPSETTING(    0x30, "3" )
  4370.     PORT_DIPSETTING(    0x10, "4" )
  4371.     PORT_DIPSETTING(    0x00, "5" )
  4372.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
  4373.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  4374.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4375.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
  4376.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  4377.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4378. INPUT_PORTS_END
  4379.  
  4380. /***************************************************************************/
  4381.  
  4382. MACHINE_DRIVER_7759( machine_driver_goldnaxe, \
  4383.     goldnaxe_readmem,goldnaxe_writemem,goldnaxe_init_machine, gfx2,upd7759_interface )
  4384.  
  4385. /***************************************************************************/
  4386. // sys16B
  4387. ROM_START( goldnaxa )
  4388.     ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
  4389.     ROM_LOAD_EVEN( "epr12545.a2", 0x00000, 0x40000, 0xa97c4e4d )
  4390.     ROM_LOAD_ODD ( "epr12544.a1", 0x00000, 0x40000, 0x5e38f668 )
  4391.  
  4392.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  4393.     ROM_LOAD( "epr12385", 0x00000, 0x20000, 0xb8a4e7e0 )
  4394.     ROM_LOAD( "epr12386", 0x20000, 0x20000, 0x25d7d779 )
  4395.     ROM_LOAD( "epr12387", 0x40000, 0x20000, 0xc7fcadf3 )
  4396.  
  4397.     ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
  4398.     ROM_LOAD( "mpr12378.b1", 0x000000, 0x40000, 0x119e5a82 )
  4399.     ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
  4400.     ROM_LOAD( "mpr12380.b2", 0x080000, 0x40000, 0xbb2c0853 )
  4401.     ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
  4402.     ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
  4403.     ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
  4404.  
  4405.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  4406.     ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
  4407.     ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
  4408. ROM_END
  4409.  
  4410. ROM_START( goldnaxb )
  4411.     ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
  4412. // Custom 68000 ver 317-0110
  4413.     ROM_LOAD_EVEN( "epr12389.a2", 0x00000, 0x40000, 0x35d5fa77 )
  4414.     ROM_LOAD_ODD ( "epr12388.a1", 0x00000, 0x40000, 0x72952a93 )
  4415.  
  4416.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  4417.     ROM_LOAD( "epr12385", 0x00000, 0x20000, 0xb8a4e7e0 )
  4418.     ROM_LOAD( "epr12386", 0x20000, 0x20000, 0x25d7d779 )
  4419.     ROM_LOAD( "epr12387", 0x40000, 0x20000, 0xc7fcadf3 )
  4420.  
  4421.     ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
  4422.     ROM_LOAD( "mpr12378.b1", 0x000000, 0x40000, 0x119e5a82 )
  4423.     ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
  4424.     ROM_LOAD( "mpr12380.b2", 0x080000, 0x40000, 0xbb2c0853 )
  4425.     ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
  4426.     ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
  4427.     ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
  4428.  
  4429.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  4430.     ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
  4431.     ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
  4432. ROM_END
  4433.  
  4434. ROM_START( goldnaxc )
  4435.     ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
  4436. // Custom 68000 ver 317-0122
  4437.     ROM_LOAD_EVEN( "epr12543.a2", 0x00000, 0x40000, 0xb0df9ca4 )
  4438.     ROM_LOAD_ODD ( "epr12542.a1", 0x00000, 0x40000, 0xb7994d3c )
  4439.  
  4440.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  4441.     ROM_LOAD( "epr12385", 0x00000, 0x20000, 0xb8a4e7e0 )
  4442.     ROM_LOAD( "epr12386", 0x20000, 0x20000, 0x25d7d779 )
  4443.     ROM_LOAD( "epr12387", 0x40000, 0x20000, 0xc7fcadf3 )
  4444.  
  4445.     ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
  4446.     ROM_LOAD( "mpr12378.b1", 0x000000, 0x40000, 0x119e5a82 )
  4447.     ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
  4448.     ROM_LOAD( "mpr12380.b2", 0x080000, 0x40000, 0xbb2c0853 )
  4449.     ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
  4450.     ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
  4451.     ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
  4452.  
  4453.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  4454.     ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
  4455.     ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
  4456. ROM_END
  4457.  
  4458.  
  4459. /***************************************************************************/
  4460.  
  4461. static READ_HANDLER( goldnaxa_skip_r )
  4462. {
  4463.     if (cpu_get_pc()==0x3ca0) {cpu_spinuntil_int(); return 0xffff;}
  4464.  
  4465.     return READ_WORD(&sys16_workingram[0x2c1c]);
  4466. }
  4467.  
  4468. // This version has somekind of hardware comparitor for collision detection,
  4469. // and a hardware multiplier.
  4470. static int ga_hardware_collision_data[5];
  4471. static WRITE_HANDLER( ga_hardware_collision_w )
  4472. {
  4473.     static int bit=1;
  4474.     ga_hardware_collision_data[offset/2]=data;
  4475.     if(offset==4)
  4476.     {
  4477.         if(ga_hardware_collision_data[2] <= ga_hardware_collision_data[0] &&
  4478.             ga_hardware_collision_data[2] >= ga_hardware_collision_data[1])
  4479.         {
  4480.             ga_hardware_collision_data[4] |=bit;
  4481.         }
  4482.         bit=bit<<1;
  4483.     }
  4484.     if(offset==8) bit=1;
  4485. }
  4486.  
  4487. static READ_HANDLER( ga_hardware_collision_r )
  4488. {
  4489.     return ga_hardware_collision_data[4];
  4490. }
  4491.  
  4492. static int ga_hardware_multiplier_data[4];
  4493. static WRITE_HANDLER( ga_hardware_multiplier_w )
  4494. {
  4495.     ga_hardware_multiplier_data[offset/2]=data;
  4496. }
  4497.  
  4498. static READ_HANDLER( ga_hardware_multiplier_r )
  4499. {
  4500.     if(offset==6)
  4501.         return ga_hardware_multiplier_data[0] * ga_hardware_multiplier_data[1];
  4502.     else
  4503.         return ga_hardware_multiplier_data[offset/2];
  4504. }
  4505.  
  4506. static struct MemoryReadAddress goldnaxa_readmem[] =
  4507. {
  4508.     { 0x000000, 0x07ffff, MRA_ROM },
  4509.  
  4510.     { 0x100000, 0x10ffff, MRA_TILERAM },
  4511.     { 0x110000, 0x110fff, MRA_TEXTRAM },
  4512.     { 0x140000, 0x140fff, MRA_PALETTERAM },
  4513.     { 0x1e0008, 0x1e0009, ga_hardware_collision_r },
  4514.     { 0x1f0000, 0x1f0007, ga_hardware_multiplier_r },
  4515.     { 0x1f1008, 0x1f1009, ga_hardware_collision_r },
  4516.     { 0x1f2000, 0x1f2003, MRA_EXTRAM },
  4517.     { 0x200000, 0x200fff, MRA_SPRITERAM },
  4518.     { 0xc41002, 0xc41003, io_player1_r },
  4519.     { 0xc41006, 0xc41007, io_player2_r },
  4520.     { 0xc41000, 0xc41001, io_service_r },
  4521.     { 0xc42002, 0xc42003, io_dip1_r },
  4522.     { 0xc42000, 0xc42001, io_dip2_r },
  4523.     { 0xc40000, 0xc40fff, MRA_EXTRAM2 },
  4524.     { 0xffecd0, 0xffecd1, ga_io_players_r },
  4525.     { 0xffec96, 0xffec97, ga_io_service_r },
  4526.     { 0xffec1c, 0xffec1d, goldnaxa_skip_r },
  4527.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  4528.     {-1}
  4529. };
  4530.  
  4531. static struct MemoryWriteAddress goldnaxa_writemem[] =
  4532. {
  4533.     { 0x000000, 0x07ffff, MWA_ROM },
  4534.     { 0x100000, 0x10ffff, MWA_TILERAM },
  4535.     { 0x110000, 0x110fff, MWA_TEXTRAM },
  4536.     { 0x140000, 0x140fff, MWA_PALETTERAM },
  4537.     { 0x1e0000, 0x1e0009, ga_hardware_collision_w },
  4538.     { 0x1f0000, 0x1f0003, ga_hardware_multiplier_w },
  4539.     { 0x1f1000, 0x1f1009, ga_hardware_collision_w },
  4540.     { 0x1f2000, 0x1f2003, MWA_EXTRAM },
  4541.     { 0x200000, 0x200fff, MWA_SPRITERAM },
  4542.     { 0xc40000, 0xc40fff, MWA_EXTRAM2 },
  4543.     { 0xffecfc, 0xffecfd, ga_sound_command_w },
  4544.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  4545.     {-1}
  4546. };
  4547. /***************************************************************************/
  4548.  
  4549. static void goldnaxa_update_proc( void ){
  4550.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  4551.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  4552.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  4553.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  4554.  
  4555.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  4556.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  4557.     set_tile_bank( READ_WORD( &sys16_workingram[0x2c94] ) );
  4558.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  4559. }
  4560.  
  4561. static void goldnaxa_init_machine( void ){
  4562.     static int bank[16] = { 0,2,8,10,16,18,0,0,4,6,12,14,20,22,0,0 };
  4563.  
  4564.     sys16_obj_bank = bank;
  4565.  
  4566.     patch_code( 0x3CA2, 0x60 );
  4567.     patch_code( 0x3CA3, 0x1e );
  4568.  
  4569.     sys16_sprxoffset = -0xb8;
  4570.     sys16_update_proc = goldnaxa_update_proc;
  4571. }
  4572.  
  4573. /***************************************************************************/
  4574.  
  4575. MACHINE_DRIVER_7759( machine_driver_goldnaxa, \
  4576.     goldnaxa_readmem,goldnaxa_writemem,goldnaxa_init_machine, gfx2,upd7759_interface )
  4577.  
  4578. /***************************************************************************/
  4579. // sys16B
  4580. ROM_START( hwchamp )
  4581.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  4582.     ROM_LOAD_EVEN( "rom0-e.bin", 0x000000, 0x20000, 0xe5abfed7 )
  4583.     ROM_LOAD_ODD ( "rom0-o.bin", 0x000000, 0x20000, 0x25180124 )
  4584.  
  4585.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  4586.     ROM_LOAD( "scr01.bin", 0x00000, 0x20000, 0xfc586a86 )
  4587.     ROM_LOAD( "scr11.bin", 0x20000, 0x20000, 0xaeaaa9d8 )
  4588.     ROM_LOAD( "scr02.bin", 0x40000, 0x20000, 0x7715a742 )
  4589.     ROM_LOAD( "scr12.bin", 0x60000, 0x20000, 0x63a82afa )
  4590.     ROM_LOAD( "scr03.bin", 0x80000, 0x20000, 0xf30cd5fd )
  4591.     ROM_LOAD( "scr13.bin", 0xA0000, 0x20000, 0x5b8494a8 )
  4592.  
  4593.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  4594.     ROM_LOAD( "obj0-o.bin", 0x000000, 0x020000, 0xfc098a13 )
  4595.     ROM_LOAD( "obj0-e.bin", 0x020000, 0x020000, 0x5db934a8 )
  4596.     ROM_LOAD( "obj1-o.bin", 0x040000, 0x020000, 0x1f27ee74 )
  4597.     ROM_LOAD( "obj1-e.bin", 0x060000, 0x020000, 0x8a6a5cf1 )
  4598.     ROM_LOAD( "obj2-o.bin", 0x080000, 0x020000, 0xc0b2ba82 )
  4599.     ROM_LOAD( "obj2-e.bin", 0x0a0000, 0x020000, 0xd6c7917b )
  4600.     ROM_LOAD( "obj3-o.bin", 0x0c0000, 0x020000, 0x52fa3a49 )
  4601.     ROM_LOAD( "obj3-e.bin", 0x0e0000, 0x020000, 0x57e8f9d2 )
  4602.  
  4603.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  4604.     ROM_LOAD( "s-prog.bin", 0x0000, 0x8000, 0x96a12d9d )
  4605.  
  4606.     ROM_LOAD( "speech0.bin", 0x10000, 0x20000, 0x4191c03d )
  4607.     ROM_LOAD( "speech1.bin", 0x30000, 0x20000, 0xa4d53f7b )
  4608. ROM_END
  4609.  
  4610. /***************************************************************************/
  4611.  
  4612. static int hwc_handles_shifts[3];
  4613.  
  4614. static WRITE_HANDLER( hwc_io_handles_w )
  4615. {
  4616.     hwc_handles_shifts[offset/2]=7;
  4617. }
  4618.  
  4619. static READ_HANDLER( hwc_io_handles_r )
  4620. {
  4621.     static int dodge_toggle=0;
  4622.     int data=0,ret;
  4623.     if(offset==0)
  4624.     {
  4625.         // monitor
  4626.         data=input_port_0_r( offset );
  4627.         if(input_port_1_r( offset ) & 4)
  4628.         {
  4629.             if(dodge_toggle)
  4630.                 data=0x38;
  4631.             else
  4632.                 data=0x60;
  4633.         }
  4634.         if(input_port_1_r( offset ) & 8)
  4635.         {
  4636.             if(dodge_toggle)
  4637.                 data=0xc8;
  4638.             else
  4639.                 data=0xa0;
  4640.         }
  4641.         if(input_port_1_r( offset ) & 0x10)
  4642.         {
  4643.             if(dodge_toggle)
  4644.                 data=0xff;
  4645.             else
  4646.                 data=0xe0;
  4647.         }
  4648.         if(input_port_1_r( offset ) & 0x20)
  4649.         {
  4650.             if(dodge_toggle)
  4651.                 data=0x0;
  4652.             else
  4653.                 data=0x20;
  4654.         }
  4655.         if(hwc_handles_shifts[offset/2]==0)
  4656.             dodge_toggle^=1;
  4657.     }
  4658.     else if(offset==2)
  4659.     {
  4660.         // left handle
  4661.         if(input_port_1_r( offset ) & 1)
  4662.             data=0xff;
  4663.     }
  4664.     else
  4665.     {
  4666.         // right handle
  4667.         if(input_port_1_r( offset ) & 2)
  4668.             data=0xff;
  4669.     }
  4670.     ret=data>>hwc_handles_shifts[offset/2];
  4671.     hwc_handles_shifts[offset/2]--;
  4672.     return ret;
  4673. }
  4674.  
  4675. static struct MemoryReadAddress hwchamp_readmem[] =
  4676. {
  4677.     { 0x000000, 0x03ffff, MRA_ROM },
  4678.     { 0x3f0000, 0x3fffff, MRA_EXTRAM },
  4679.     { 0x400000, 0x40ffff, MRA_TILERAM },
  4680.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  4681.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  4682.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  4683.     { 0xc43020, 0xc43025, hwc_io_handles_r },
  4684.     { 0xc41000, 0xc41001, io_service_r },
  4685.     { 0xc42002, 0xc42003, io_dip1_r },
  4686.     { 0xc42000, 0xc42001, io_dip2_r },
  4687.     { 0xc40000, 0xc43fff, MRA_EXTRAM2 },
  4688.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  4689.     {-1}
  4690. };
  4691.  
  4692. static struct MemoryWriteAddress hwchamp_writemem[] =
  4693. {
  4694.     { 0x000000, 0x03ffff, MWA_ROM },
  4695.     { 0x3f0000, 0x3fffff, MWA_EXTRAM },
  4696.     { 0x400000, 0x40ffff, MWA_TILERAM },
  4697.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  4698.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  4699.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  4700.     { 0xc43020, 0xc43025, hwc_io_handles_w },
  4701.     { 0xc40000, 0xc43fff, MWA_EXTRAM2 },
  4702.     { 0xfe0006, 0xfe0007, sound_command_w },
  4703.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  4704.     {-1}
  4705. };
  4706. /***************************************************************************/
  4707.  
  4708. static void hwchamp_update_proc( void ){
  4709.     int leds;
  4710.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  4711.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  4712.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  4713.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  4714.  
  4715.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  4716.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  4717.  
  4718.     sys16_tile_bank0 = READ_WORD( &sys16_extraram[0x0000] )&0xf;
  4719.     sys16_tile_bank1 = READ_WORD( &sys16_extraram[0x0002] )&0xf;
  4720.  
  4721.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  4722.  
  4723.     leds=READ_WORD( &sys16_extraram2[0x3034] );
  4724.     if(leds & 0x20)
  4725.         osd_led_w(0,1);
  4726.     else
  4727.         osd_led_w(0,0);
  4728.     if(leds & 0x80)
  4729.         osd_led_w(1,1);
  4730.     else
  4731.         osd_led_w(1,0);
  4732.     if(leds & 0x40)
  4733.         osd_led_w(2,1);
  4734.     else
  4735.         osd_led_w(2,0);
  4736.  
  4737. }
  4738.  
  4739. static void hwchamp_init_machine( void ){
  4740.     static int bank[16] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
  4741.  
  4742.     sys16_obj_bank = bank;
  4743.     sys16_spritelist_end=0xc000;
  4744.  
  4745.     sys16_update_proc = hwchamp_update_proc;
  4746. }
  4747.  
  4748. static void init_hwchamp( void )
  4749. {
  4750.     sys16_onetime_init_machine();
  4751.     sys16_sprite_decode( 4,0x040000 );
  4752. }
  4753. /***************************************************************************/
  4754.  
  4755. INPUT_PORTS_START( hwchamp )
  4756.  
  4757. PORT_START    /* Monitor */
  4758.     PORT_ANALOG( 0xff, 0x80, IPT_PADDLE  , 70, 4, 0x0, 0xff )
  4759.  
  4760. PORT_START    /* Handles (Fake) */
  4761.     PORT_BITX(0x01, 0, IPT_BUTTON1, IP_NAME_DEFAULT, KEYCODE_F, IP_JOY_NONE ) // right hit
  4762.     PORT_BITX(0x02, 0, IPT_BUTTON2, IP_NAME_DEFAULT, KEYCODE_D, IP_JOY_NONE ) // left hit
  4763.     PORT_BITX(0x04, 0, IPT_BUTTON3, IP_NAME_DEFAULT, KEYCODE_B, IP_JOY_NONE ) // right dodge
  4764.     PORT_BITX(0x08, 0, IPT_BUTTON4, IP_NAME_DEFAULT, KEYCODE_Z, IP_JOY_NONE ) // left dodge
  4765.     PORT_BITX(0x10, 0, IPT_BUTTON5, IP_NAME_DEFAULT, KEYCODE_V, IP_JOY_NONE ) // right sway
  4766.     PORT_BITX(0x20, 0, IPT_BUTTON6, IP_NAME_DEFAULT, KEYCODE_X, IP_JOY_NONE ) // left swat
  4767.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  4768.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  4769.  
  4770.     SYS16_SERVICE
  4771.     SYS16_COINAGE
  4772.  
  4773. PORT_START    /* DSW1 */
  4774.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )    // Not Used
  4775.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  4776.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4777.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  4778.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  4779.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4780.     PORT_DIPNAME( 0x04, 0x00, "Start Level Select" )
  4781.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  4782.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4783.     PORT_DIPNAME( 0x08, 0x08, "Continue Mode" )
  4784.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  4785.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  4786.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
  4787.     PORT_DIPSETTING(    0x20, "Easy" )
  4788.     PORT_DIPSETTING(    0x30, "Normal" )
  4789.     PORT_DIPSETTING(    0x10, "Hard" )
  4790.     PORT_DIPSETTING(    0x00, "Hardest" )
  4791.     PORT_DIPNAME( 0xc0, 0xc0, "Time Adjust"  )
  4792.     PORT_DIPSETTING(    0x80, "Easy" )
  4793.     PORT_DIPSETTING(    0xc0, "Normal" )
  4794.     PORT_DIPSETTING(    0x40, "Hard" )
  4795.     PORT_DIPSETTING(    0x00, "Hardest" )
  4796.  
  4797. INPUT_PORTS_END
  4798.  
  4799. /***************************************************************************/
  4800.  
  4801. MACHINE_DRIVER_7759( machine_driver_hwchamp, \
  4802.     hwchamp_readmem,hwchamp_writemem,hwchamp_init_machine, gfx4 ,upd7759_interface)
  4803.  
  4804. /***************************************************************************/
  4805. // pre16
  4806. ROM_START( mjleague )
  4807.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  4808.     ROM_LOAD_EVEN( "epr-7404.09b", 0x000000, 0x8000, 0xec1655b5 )
  4809.     ROM_LOAD_ODD ( "epr-7401.06b", 0x000000, 0x8000, 0x2befa5e0 )
  4810.     ROM_LOAD_EVEN( "epr-7405.10b", 0x010000, 0x8000, 0x7a4f4e38 )
  4811.     ROM_LOAD_ODD ( "epr-7402.07b", 0x010000, 0x8000, 0xb7bef762 )
  4812.     ROM_LOAD_EVEN( "epra7406.11b", 0x020000, 0x8000, 0xbb743639 )
  4813.     ROM_LOAD_ODD ( "epra7403.08b", 0x020000, 0x8000, 0xd86250cf )    // Fails memory test. Bad rom?
  4814.  
  4815.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  4816.     ROM_LOAD( "epr-7051.09a", 0x00000, 0x08000, 0x10ca255a )
  4817.     ROM_RELOAD(               0x08000, 0x08000 )
  4818.     ROM_LOAD( "epr-7052.10a", 0x10000, 0x08000, 0x2550db0e )
  4819.     ROM_RELOAD(               0x18000, 0x08000 )
  4820.     ROM_LOAD( "epr-7053.11a", 0x20000, 0x08000, 0x5bfea038 )
  4821.     ROM_RELOAD(               0x28000, 0x08000 )
  4822.  
  4823.     ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites */
  4824.     ROM_LOAD( "epr-7055.05a", 0x000000, 0x008000, 0x1fb860bd )
  4825.     ROM_LOAD( "epr-7059.02b", 0x008000, 0x008000, 0x3d14091d )
  4826.     ROM_LOAD( "epr-7056.06a", 0x010000, 0x008000, 0xb35dd968 )
  4827.     ROM_LOAD( "epr-7060.03b", 0x018000, 0x008000, 0x61bb3757 )
  4828.     ROM_LOAD( "epr-7057.07a", 0x020000, 0x008000, 0x3e5a2b6f )
  4829.     ROM_LOAD( "epr-7061.04b", 0x028000, 0x008000, 0xc808dad5 )
  4830.     ROM_LOAD( "epr-7058.08a", 0x030000, 0x008000, 0xb543675f )
  4831.     ROM_LOAD( "epr-7062.05b", 0x038000, 0x008000, 0x9168eb47 )
  4832. //    ROM_LOAD( "epr-7055.05a", 0x040000, 0x008000, 0x1fb860bd ) loaded twice??
  4833. //    ROM_LOAD( "epr-7059.02b", 0x048000, 0x008000, 0x3d14091d ) loaded twice??
  4834.  
  4835.     ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
  4836.     ROM_LOAD( "eprc7054.01b", 0x00000, 0x8000, 0x4443b744 )
  4837.  
  4838.     ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
  4839.     ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
  4840.  
  4841.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
  4842.     ROM_LOAD( "epr-7063.01a", 0x00000, 0x8000, 0x45d8908a )
  4843.     ROM_LOAD( "epr-7065.02a", 0x08000, 0x8000, 0x8c8f8cff )
  4844.     ROM_LOAD( "epr-7064.03a", 0x10000, 0x8000, 0x159f6636 )
  4845.     ROM_LOAD( "epr-7066.04a", 0x18000, 0x8000, 0xf5cfa91f )
  4846. ROM_END
  4847.  
  4848. /***************************************************************************/
  4849.  
  4850. static READ_HANDLER( mjl_io_player1_r )
  4851. {
  4852.     int data=input_port_0_r( offset ) & 0x80;
  4853.  
  4854.     if(READ_WORD( &sys16_extraram2[2] ) & 0x4)
  4855.         data|=(input_port_5_r( offset ) & 0x3f) << 1;
  4856.     else
  4857.         data|=(input_port_6_r( offset ) & 0x3f) << 1;
  4858.  
  4859.     return data;
  4860. }
  4861.  
  4862. static READ_HANDLER( mjl_io_service_r )
  4863. {
  4864.     int data=input_port_2_r( offset ) & 0x3f;
  4865.  
  4866.     if(READ_WORD( &sys16_extraram2[2] ) & 0x4)
  4867.     {
  4868.         data|=(input_port_5_r( offset ) & 0x40);
  4869.         data|=(input_port_7_r( offset ) & 0x40) << 1;
  4870.     }
  4871.     else
  4872.     {
  4873.         data|=(input_port_6_r( offset ) & 0x40);
  4874.         data|=(input_port_8_r( offset ) & 0x40) << 1;
  4875.     }
  4876.  
  4877.     return data;
  4878. }
  4879.  
  4880. static READ_HANDLER( mjl_io_player2_r )
  4881. {
  4882.     int data=input_port_1_r( offset ) & 0x80;
  4883.     if(READ_WORD( &sys16_extraram2[2] ) & 0x4)
  4884.         data|=(input_port_7_r( offset ) & 0x3f) << 1;
  4885.     else
  4886.         data|=(input_port_8_r( offset ) & 0x3f) << 1;
  4887.     return data;
  4888. }
  4889.  
  4890. static READ_HANDLER( mjl_io_bat_r )
  4891. {
  4892.     int data1=input_port_0_r( offset );
  4893.     int data2=input_port_1_r( offset );
  4894.     int ret=0;
  4895.  
  4896.     // Hitting has 8 values, but for easy of playing, I've only added 3
  4897.  
  4898.     if(data1 &1) ret=0x00;
  4899.     else if(data1 &2) ret=0x03;
  4900.     else if(data1 &4) ret=0x07;
  4901.     else ret=0x0f;
  4902.  
  4903.     if(data2 &1) ret|=0x00;
  4904.     else if(data2 &2) ret|=0x30;
  4905.     else if(data2 &4) ret|=0x70;
  4906.     else ret|=0xf0;
  4907.  
  4908.     return ret;
  4909.  
  4910. }
  4911.  
  4912. static struct MemoryReadAddress mjleague_readmem[] =
  4913. {
  4914.     { 0x000000, 0x02ffff, MRA_ROM },
  4915.     { 0x400000, 0x40ffff, MRA_TILERAM },
  4916.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  4917.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  4918.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  4919.  
  4920.     { 0xc40002, 0xc40007, MRA_EXTRAM2},
  4921.     { 0xc41000, 0xc41001, mjl_io_service_r },
  4922.     { 0xc41002, 0xc41003, mjl_io_player1_r },
  4923.     { 0xc41006, 0xc41007, mjl_io_player2_r },
  4924.     { 0xc41004, 0xc41005, mjl_io_bat_r },
  4925.     { 0xc42000, 0xc42001, io_dip1_r },
  4926.     { 0xc42002, 0xc42003, io_dip2_r },
  4927.     { 0xc60000, 0xc60001, MRA_NOP }, /* What is this? Watchdog? */
  4928.  
  4929.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  4930.     {-1}
  4931. };
  4932.  
  4933. static struct MemoryWriteAddress mjleague_writemem[] =
  4934. {
  4935.     { 0x000000, 0x02ffff, MWA_ROM },
  4936.     { 0x400000, 0x40ffff, MWA_TILERAM },
  4937.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  4938.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  4939.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  4940.     { 0xc40000, 0xc40001, sound_command_nmi_w },
  4941.     { 0xc40002, 0xc40007, MWA_EXTRAM2},
  4942.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  4943.     {-1}
  4944. };
  4945. /***************************************************************************/
  4946.  
  4947. static void mjleague_update_proc( void ){
  4948.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
  4949.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
  4950.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
  4951.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
  4952.  
  4953.     set_fg_page1( READ_WORD( &sys16_textram[0x0e8e] ) );
  4954.     set_bg_page1( READ_WORD( &sys16_textram[0x0e8c] ) );
  4955.  
  4956.     set_refresh_3d( READ_WORD( &sys16_extraram2[0] ) );
  4957. }
  4958.  
  4959. static void mjleague_init_machine( void ){
  4960.     static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
  4961.  
  4962.     sys16_obj_bank = bank;
  4963.     sys16_textmode=1;
  4964.     sys16_spritesystem = 2;
  4965.     sys16_sprxoffset = -0xbd;
  4966.     sys16_fgxoffset = sys16_bgxoffset = 7;
  4967.  
  4968.     // remove memory test because it fails.
  4969.     patch_code( 0xBD42, 0x66 );
  4970.  
  4971.     sys16_update_proc = mjleague_update_proc;
  4972. }
  4973.  
  4974. static void init_mjleague( void )
  4975. {
  4976.     sys16_onetime_init_machine();
  4977.     sys16_sprite_decode( 5,0x010000 );
  4978. }
  4979.  
  4980. /***************************************************************************/
  4981.  
  4982. INPUT_PORTS_START( mjleague )
  4983.  
  4984. PORT_START /* player 1 button fake */
  4985.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
  4986.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  4987.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 )
  4988.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 )
  4989.  
  4990. PORT_START /* player 1 button fake */
  4991.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  4992.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_PLAYER2 )
  4993.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 | IPF_PLAYER2 )
  4994.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 | IPF_PLAYER2 )
  4995.  
  4996. PORT_START  /* Service */
  4997.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  4998.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  4999.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  5000.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
  5001.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
  5002.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  5003.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  5004.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  5005.  
  5006.     SYS16_COINAGE
  5007.  
  5008. PORT_START    /* DSW1 */
  5009.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  5010.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  5011.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  5012.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  5013.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  5014.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  5015.     PORT_DIPNAME( 0x0c, 0x00, "Starting Points" )
  5016.     PORT_DIPSETTING(    0x0c, "2000" )
  5017.     PORT_DIPSETTING(    0x08, "3000" )
  5018.     PORT_DIPSETTING(    0x04, "5000" )
  5019.     PORT_DIPSETTING(    0x00, "10000" )
  5020.     PORT_DIPNAME( 0x10, 0x10, "Team Select" )
  5021.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  5022.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  5023.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )    //??? something to do with cocktail mode?
  5024.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  5025.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  5026.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  5027.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  5028.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  5029.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  5030.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  5031.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  5032.  
  5033. PORT_START    /* IN5 */
  5034.     PORT_ANALOG( 0x7f, 0x40, IPT_TRACKBALL_Y, 70, 30, 0, 127 )
  5035.  
  5036. PORT_START    /* IN6 */
  5037.     PORT_ANALOG( 0x7f, 0x40, IPT_TRACKBALL_X /*| IPF_REVERSE*/, 50, 30, 0, 127 )
  5038.  
  5039. PORT_START    /* IN7 */
  5040.     PORT_ANALOG( 0x7f, 0x40, IPT_TRACKBALL_Y | IPF_PLAYER2, 70, 30, 0, 127 )
  5041.  
  5042. PORT_START    /* IN8 */
  5043.     PORT_ANALOG( 0x7f, 0x40, IPT_TRACKBALL_X | IPF_PLAYER2 | IPF_REVERSE, 50, 30, 0, 127 )
  5044.  
  5045. INPUT_PORTS_END
  5046.  
  5047. /***************************************************************************/
  5048.  
  5049. MACHINE_DRIVER_7751( machine_driver_mjleague, \
  5050.     mjleague_readmem,mjleague_writemem,mjleague_init_machine, gfx1)
  5051.  
  5052. /***************************************************************************/
  5053. // sys18
  5054. ROM_START( moonwalk )
  5055.     ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
  5056. // custom cpu 317-0159
  5057.     ROM_LOAD_EVEN( "epr13235.a6", 0x000000, 0x40000, 0x6983e129 )
  5058.     ROM_LOAD_ODD ( "epr13234.a5", 0x000000, 0x40000, 0xc9fd20f2 )
  5059.  
  5060.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  5061.     ROM_LOAD( "mpr13216.b1", 0x00000, 0x40000, 0x862d2c03 )
  5062.     ROM_LOAD( "mpr13217.b2", 0x40000, 0x40000, 0x7d1ac3ec )
  5063.     ROM_LOAD( "mpr13218.b3", 0x80000, 0x40000, 0x56d3393c )
  5064.  
  5065.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  5066.     ROM_LOAD( "mpr13224.b11", 0x000000, 0x40000, 0xc59f107b )
  5067.     ROM_LOAD( "mpr13231.a11", 0x040000, 0x40000, 0xa5e96346 )
  5068.     ROM_LOAD( "mpr13223.b10", 0x080000, 0x40000, 0x364f60ff )
  5069.     ROM_LOAD( "mpr13230.a10", 0x0c0000, 0x40000, 0x9550091f )
  5070.     ROM_LOAD( "mpr13222.b9",  0x100000, 0x40000, 0x523df3ed )
  5071.     ROM_LOAD( "mpr13229.a9",  0x140000, 0x40000, 0xf40dc45d )
  5072.     ROM_LOAD( "epr13221.b8",  0x180000, 0x40000, 0x9ae7546a )
  5073.     ROM_LOAD( "epr13228.a8",  0x1c0000, 0x40000, 0xde3786be )
  5074.  
  5075.     ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
  5076.     ROM_LOAD( "epr13225.a4", 0x10000, 0x20000, 0x56c2e82b )
  5077.     ROM_LOAD( "mpr13219.b4", 0x30000, 0x40000, 0x19e2061f )
  5078.     ROM_LOAD( "mpr13220.b5", 0x70000, 0x40000, 0x58d4d9ce )
  5079.     ROM_LOAD( "mpr13249.b6", 0xb0000, 0x40000, 0x623edc5d )
  5080. ROM_END
  5081.  
  5082. ROM_START( moonwlka )
  5083.     ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
  5084. // custom cpu 317-0158
  5085.     ROM_LOAD_EVEN( "epr13233", 0x000000, 0x40000, 0xf3dac671 )
  5086.     ROM_LOAD_ODD ( "epr13232", 0x000000, 0x40000, 0x541d8bdf )
  5087.  
  5088.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  5089.     ROM_LOAD( "mpr13216.b1", 0x00000, 0x40000, 0x862d2c03 )
  5090.     ROM_LOAD( "mpr13217.b2", 0x40000, 0x40000, 0x7d1ac3ec )
  5091.     ROM_LOAD( "mpr13218.b3", 0x80000, 0x40000, 0x56d3393c )
  5092.  
  5093.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  5094.     ROM_LOAD( "mpr13224.b11", 0x000000, 0x40000, 0xc59f107b )
  5095.     ROM_LOAD( "mpr13231.a11", 0x040000, 0x40000, 0xa5e96346 )
  5096.     ROM_LOAD( "mpr13223.b10", 0x080000, 0x40000, 0x364f60ff )
  5097.     ROM_LOAD( "mpr13230.a10", 0x0c0000, 0x40000, 0x9550091f )
  5098.     ROM_LOAD( "mpr13222.b9",  0x100000, 0x40000, 0x523df3ed )
  5099.     ROM_LOAD( "mpr13229.a9",  0x140000, 0x40000, 0xf40dc45d )
  5100.     ROM_LOAD( "epr13221.b8",  0x180000, 0x40000, 0x9ae7546a )
  5101.     ROM_LOAD( "epr13228.a8",  0x1c0000, 0x40000, 0xde3786be )
  5102.  
  5103.     ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
  5104.     ROM_LOAD( "epr13225.a4", 0x10000, 0x20000, 0x56c2e82b )
  5105.     ROM_LOAD( "mpr13219.b4", 0x30000, 0x40000, 0x19e2061f )
  5106.     ROM_LOAD( "mpr13220.b5", 0x70000, 0x40000, 0x58d4d9ce )
  5107.     ROM_LOAD( "mpr13249.b6", 0xb0000, 0x40000, 0x623edc5d )
  5108. ROM_END
  5109.  
  5110. // sys18
  5111. ROM_START( moonwlkb )
  5112.     ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
  5113.     ROM_LOAD_EVEN( "moonwlkb.01", 0x000000, 0x10000, 0xf49cdb16 )
  5114.     ROM_LOAD_ODD ( "moonwlkb.05", 0x000000, 0x10000, 0xc483f29f )
  5115.     ROM_LOAD_EVEN( "moonwlkb.02", 0x020000, 0x10000, 0x0bde1896 )
  5116.     ROM_LOAD_ODD ( "moonwlkb.06", 0x020000, 0x10000, 0x5b9fc688 )
  5117.     ROM_LOAD_EVEN( "moonwlkb.03", 0x040000, 0x10000, 0x0c5fe15c )
  5118.     ROM_LOAD_ODD ( "moonwlkb.07", 0x040000, 0x10000, 0x9e600704 )
  5119.     ROM_LOAD_EVEN( "moonwlkb.04", 0x060000, 0x10000, 0x64692f79 )
  5120.     ROM_LOAD_ODD ( "moonwlkb.08", 0x060000, 0x10000, 0x546ca530 )
  5121.  
  5122.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  5123.     ROM_LOAD( "mpr13216.b1", 0x00000, 0x40000, 0x862d2c03 )
  5124.     ROM_LOAD( "mpr13217.b2", 0x40000, 0x40000, 0x7d1ac3ec )
  5125.     ROM_LOAD( "mpr13218.b3", 0x80000, 0x40000, 0x56d3393c )
  5126.  
  5127.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  5128.     ROM_LOAD( "mpr13224.b11", 0x000000, 0x40000, 0xc59f107b )
  5129.     ROM_LOAD( "mpr13231.a11", 0x040000, 0x40000, 0xa5e96346 )
  5130.     ROM_LOAD( "mpr13223.b10", 0x080000, 0x40000, 0x364f60ff )
  5131.     ROM_LOAD( "mpr13230.a10", 0x0c0000, 0x40000, 0x9550091f )
  5132.     ROM_LOAD( "mpr13222.b9",  0x100000, 0x40000, 0x523df3ed )
  5133.     ROM_LOAD( "mpr13229.a9",  0x140000, 0x40000, 0xf40dc45d )
  5134.     ROM_LOAD( "epr13221.b8",  0x180000, 0x40000, 0x9ae7546a )
  5135.     ROM_LOAD( "epr13228.a8",  0x1c0000, 0x40000, 0xde3786be )
  5136.  
  5137.     ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
  5138.     ROM_LOAD( "epr13225.a4", 0x10000, 0x20000, 0x56c2e82b )
  5139.     ROM_LOAD( "mpr13219.b4", 0x30000, 0x40000, 0x19e2061f )
  5140.     ROM_LOAD( "mpr13220.b5", 0x70000, 0x40000, 0x58d4d9ce )
  5141.     ROM_LOAD( "mpr13249.b6", 0xb0000, 0x40000, 0x623edc5d )
  5142. ROM_END
  5143.  
  5144. /***************************************************************************/
  5145.  
  5146. static READ_HANDLER( moonwlkb_skip_r )
  5147. {
  5148.     if (cpu_get_pc()==0x308a) {cpu_spinuntil_int(); return 0xffff;}
  5149.  
  5150.     return READ_WORD(&sys16_workingram[0x202c]);
  5151. }
  5152.  
  5153. static struct MemoryReadAddress moonwalk_readmem[] =
  5154. {
  5155.     { 0x000000, 0x07ffff, MRA_ROM },
  5156.  
  5157.     { 0x400000, 0x40ffff, MRA_TILERAM },
  5158.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  5159.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  5160.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  5161.     { 0xc00000, 0xc0ffff, MRA_EXTRAM },
  5162.     { 0xc40000, 0xc40001, io_dip1_r },
  5163.     { 0xc40002, 0xc40003, io_dip2_r },
  5164.     { 0xc41002, 0xc41003, io_player1_r },
  5165.     { 0xc41004, 0xc41005, io_player2_r },
  5166.     { 0xc41006, 0xc41007, io_player3_r },
  5167.     { 0xc41000, 0xc41001, io_service_r },
  5168.     { 0xc40000, 0xc4ffff, MRA_EXTRAM3 },
  5169.     { 0xe40000, 0xe4ffff, MRA_EXTRAM2 },
  5170.     { 0xfe0000, 0xfeffff, MRA_EXTRAM4 },
  5171.     { 0xffe02c, 0xffe02d, moonwlkb_skip_r },
  5172.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  5173.     {-1}
  5174. };
  5175.  
  5176. static struct MemoryWriteAddress moonwalk_writemem[] =
  5177. {
  5178.     { 0x000000, 0x07ffff, MWA_ROM },
  5179.     { 0x400000, 0x40ffff, MWA_TILERAM },
  5180.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  5181.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  5182.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  5183.     { 0xc00000, 0xc0ffff, MWA_EXTRAM },
  5184.     { 0xc40006, 0xc40007, sound_command_nmi_w },
  5185.     { 0xc40000, 0xc4ffff, MWA_EXTRAM3 },
  5186.     { 0xe40000, 0xe4ffff, MWA_EXTRAM2 },
  5187.     { 0xfe0000, 0xfeffff, MWA_EXTRAM4 },
  5188.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  5189.     {-1}
  5190. };
  5191. /***************************************************************************/
  5192.  
  5193. static void moonwalk_update_proc( void ){
  5194.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  5195.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  5196.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  5197.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  5198.  
  5199.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  5200.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  5201.  
  5202.     sys16_fg2_scrollx = READ_WORD( &sys16_textram[0x0e9c] );
  5203.     sys16_bg2_scrollx = READ_WORD( &sys16_textram[0x0e9e] );
  5204.     sys16_fg2_scrolly = READ_WORD( &sys16_textram[0x0e94] );
  5205.     sys16_bg2_scrolly = READ_WORD( &sys16_textram[0x0e96] );
  5206.  
  5207.     set_fg2_page( READ_WORD( &sys16_textram[0x0e84] ) );
  5208.     set_bg2_page( READ_WORD( &sys16_textram[0x0e86] ) );
  5209.  
  5210.     if(sys16_fg2_scrollx | sys16_fg2_scrolly | READ_WORD( &sys16_textram[0x0e84] ))
  5211.         sys18_fg2_active=1;
  5212.     else
  5213.         sys18_fg2_active=0;
  5214.     if(sys16_bg2_scrollx | sys16_bg2_scrolly | READ_WORD( &sys16_textram[0x0e86] ))
  5215.         sys18_bg2_active=1;
  5216.     else
  5217.         sys18_bg2_active=0;
  5218.  
  5219.     set_tile_bank18( READ_WORD( &sys16_extraram3[0x6800] ) );
  5220.     set_refresh_18( READ_WORD( &sys16_extraram3[0x6600] ) ); // 0xc46601
  5221. }
  5222.  
  5223. static void moonwalk_init_machine( void ){
  5224.     static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
  5225.     sys16_obj_bank = bank;
  5226.     sys16_bg_priority_value=0x1000;
  5227.     sys16_sprxoffset = -0x238;
  5228.     sys16_spritelist_end=0x8000;
  5229.  
  5230.     patch_code( 0x70116, 0x4e);
  5231.     patch_code( 0x70117, 0x71);
  5232.  
  5233.     patch_code( 0x314a, 0x46);
  5234.     patch_code( 0x314b, 0x42);
  5235.  
  5236.     patch_code( 0x311b, 0x3f);
  5237.  
  5238.     patch_code( 0x70103, 0x00);
  5239.     patch_code( 0x70109, 0x00);
  5240.     patch_code( 0x07727, 0x00);
  5241.     patch_code( 0x07729, 0x00);
  5242.     patch_code( 0x0780d, 0x00);
  5243.     patch_code( 0x0780f, 0x00);
  5244.     patch_code( 0x07861, 0x00);
  5245.     patch_code( 0x07863, 0x00);
  5246.     patch_code( 0x07d47, 0x00);
  5247.     patch_code( 0x07863, 0x00);
  5248.     patch_code( 0x08533, 0x00);
  5249.     patch_code( 0x08535, 0x00);
  5250.     patch_code( 0x085bd, 0x00);
  5251.     patch_code( 0x085bf, 0x00);
  5252.     patch_code( 0x09a4b, 0x00);
  5253.     patch_code( 0x09a4d, 0x00);
  5254.     patch_code( 0x09b2f, 0x00);
  5255.     patch_code( 0x09b31, 0x00);
  5256.     patch_code( 0x0a05b, 0x00);
  5257.     patch_code( 0x0a05d, 0x00);
  5258.     patch_code( 0x0a23f, 0x00);
  5259.     patch_code( 0x0a241, 0x00);
  5260.     patch_code( 0x10159, 0x00);
  5261.     patch_code( 0x1015b, 0x00);
  5262.     patch_code( 0x109fb, 0x00);
  5263.     patch_code( 0x109fd, 0x00);
  5264.  
  5265.     // * SEGA mark
  5266.     patch_code( 0x70212, 0x4e);
  5267.     patch_code( 0x70213, 0x71);
  5268.  
  5269.     sys16_update_proc = moonwalk_update_proc;
  5270. }
  5271.  
  5272. static void init_moonwalk( void ){
  5273.     unsigned char *RAM= memory_region(REGION_CPU2);
  5274.     sys16_onetime_init_machine();
  5275.     sys18_splittab_fg_x=&sys16_textram[0x0f80];
  5276.     sys18_splittab_bg_x=&sys16_textram[0x0fc0];
  5277.  
  5278.     memcpy(RAM,&RAM[0x10000],0xa000);
  5279.  
  5280.     sys16_sprite_decode( 4,0x080000 );
  5281. }
  5282.  
  5283. /***************************************************************************/
  5284.  
  5285. INPUT_PORTS_START( moonwalk )
  5286.  
  5287. PORT_START /* player 1 */
  5288.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
  5289.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  5290.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
  5291.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  5292.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  5293.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  5294.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  5295.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  5296.  
  5297. PORT_START /* player 2 */
  5298.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  5299.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  5300.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  5301.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  5302.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
  5303.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
  5304.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  5305.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
  5306.  
  5307. PORT_START /* service */
  5308.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  5309.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  5310.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  5311.     PORT_BITX(0x08, 0x08, IPT_TILT, "Test", KEYCODE_T, IP_JOY_NONE )
  5312.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
  5313.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  5314.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  5315.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  5316.  
  5317.     SYS16_COINAGE
  5318.  
  5319. PORT_START    /* DSW1 */
  5320.     PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
  5321.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  5322.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  5323.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  5324.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  5325.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  5326.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) )
  5327.     PORT_DIPSETTING(    0x04, "2" )
  5328.     PORT_DIPSETTING(    0x00, "3" )
  5329.     PORT_DIPNAME( 0x08, 0x08, "Player Vitality" )
  5330.     PORT_DIPSETTING(    0x08, "Low" )
  5331.     PORT_DIPSETTING(    0x00, "High" )
  5332.     PORT_DIPNAME( 0x10, 0x00, "Play Mode" )
  5333.     PORT_DIPSETTING(    0x10, "2 Players" )
  5334.     PORT_DIPSETTING(    0x00, "3 Players" )
  5335.     PORT_DIPNAME( 0x20, 0x20, "Coin Mode" )
  5336.     PORT_DIPSETTING(    0x20, "Common" )
  5337.     PORT_DIPSETTING(    0x00, "Individual" )
  5338.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
  5339.     PORT_DIPSETTING(    0x80, "Easy" )
  5340.     PORT_DIPSETTING(    0xc0, "Normal" )
  5341.     PORT_DIPSETTING(    0x40, "Hard" )
  5342.     PORT_DIPSETTING(    0x00, "Hardest" )
  5343.  
  5344. PORT_START /* player 3 */
  5345.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  5346.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  5347.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
  5348. //    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  5349.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 )
  5350.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER3 )
  5351.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER3 )
  5352.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 )
  5353.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER3 )
  5354. INPUT_PORTS_END
  5355.  
  5356. /***************************************************************************/
  5357.  
  5358. MACHINE_DRIVER_18( machine_driver_moonwalk, \
  5359.     moonwalk_readmem,moonwalk_writemem,moonwalk_init_machine, gfx4 )
  5360.  
  5361. /***************************************************************************/
  5362. // sys16B
  5363. ROM_START( passsht )
  5364.     ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
  5365.     ROM_LOAD_EVEN( "epr11871.a4", 0x000000, 0x10000, 0x0f9ccea5 )
  5366.     ROM_LOAD_ODD ( "epr11870.a1", 0x000000, 0x10000, 0xdf43ebcf )
  5367.  
  5368.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  5369.     ROM_LOAD( "opr11854.b9",  0x00000, 0x10000, 0xd31c0b6c )
  5370.     ROM_LOAD( "opr11855.b10", 0x10000, 0x10000, 0xb78762b4 )
  5371.     ROM_LOAD( "opr11856.b11", 0x20000, 0x10000, 0xea49f666 )
  5372.  
  5373.     ROM_REGION( 0x60000*2, REGION_GFX2 ) /* sprites */
  5374.     ROM_LOAD( "opr11862.b1",  0x00000, 0x10000, 0xb6e94727 )
  5375.     ROM_LOAD( "opr11865.b5",  0x10000, 0x10000, 0x17e8d5d5 )
  5376.     ROM_LOAD( "opr11863.b2",  0x20000, 0x10000, 0x3e670098 )
  5377.     ROM_LOAD( "opr11866.b6",  0x30000, 0x10000, 0x50eb71cc )
  5378.     ROM_LOAD( "opr11864.b3",  0x40000, 0x10000, 0x05733ca8 )
  5379.     ROM_LOAD( "opr11867.b7",  0x50000, 0x10000, 0x81e49697 )
  5380.  
  5381.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  5382.     ROM_LOAD( "epr11857.a7",  0x00000, 0x08000, 0x789edc06 )
  5383.     ROM_LOAD( "epr11858.a8",  0x10000, 0x08000, 0x08ab0018 )
  5384.     ROM_LOAD( "epr11859.a9",  0x18000, 0x08000, 0x8673e01b )
  5385.     ROM_LOAD( "epr11860.a10", 0x20000, 0x08000, 0x10263746 )
  5386.     ROM_LOAD( "epr11861.a11", 0x28000, 0x08000, 0x38b54a71 )
  5387. ROM_END
  5388.  
  5389. ROM_START( passht4b )
  5390.     ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
  5391.     ROM_LOAD_EVEN( "pas4p.3", 0x000000, 0x10000, 0x2d8bc946 )
  5392.     ROM_LOAD_ODD ( "pas4p.4", 0x000000, 0x10000, 0xe759e831 )
  5393.  
  5394.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  5395.     ROM_LOAD( "pas4p.11",  0x00000, 0x10000, 0xda20fbc9 )
  5396.     ROM_LOAD( "pas4p.12", 0x10000, 0x10000, 0xbebb9211 )
  5397.     ROM_LOAD( "pas4p.13", 0x20000, 0x10000, 0xe37506c3 )
  5398.  
  5399.     ROM_REGION( 0x60000*2, REGION_GFX2 ) /* sprites */
  5400.     ROM_LOAD( "opr11862.b1",  0x00000, 0x10000, 0xb6e94727 )
  5401.     ROM_LOAD( "opr11865.b5",  0x10000, 0x10000, 0x17e8d5d5 )
  5402.     ROM_LOAD( "opr11863.b2",  0x20000, 0x10000, 0x3e670098 )
  5403.     ROM_LOAD( "opr11866.b6",  0x30000, 0x10000, 0x50eb71cc )
  5404.     ROM_LOAD( "opr11864.b3",  0x40000, 0x10000, 0x05733ca8 )
  5405.     ROM_LOAD( "opr11867.b7",  0x50000, 0x10000, 0x81e49697 )
  5406.  
  5407.     ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
  5408.     ROM_LOAD( "pas4p.1",  0x00000, 0x08000, 0xe60fb017 )
  5409.     ROM_LOAD( "pas4p.2",  0x10000, 0x10000, 0x092e016e )
  5410. ROM_END
  5411.  
  5412. ROM_START( passshtb )
  5413.     ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
  5414.     ROM_LOAD_EVEN( "pass3_2p.bin", 0x000000, 0x10000, 0x26bb9299 )
  5415.     ROM_LOAD_ODD ( "pass4_2p.bin", 0x000000, 0x10000, 0x06ac6d5d )
  5416.  
  5417.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  5418.     ROM_LOAD( "opr11854.b9",  0x00000, 0x10000, 0xd31c0b6c )
  5419.     ROM_LOAD( "opr11855.b10", 0x10000, 0x10000, 0xb78762b4 )
  5420.     ROM_LOAD( "opr11856.b11", 0x20000, 0x10000, 0xea49f666 )
  5421.  
  5422.     ROM_REGION( 0x60000*2, REGION_GFX2 ) /* sprites */
  5423.     ROM_LOAD( "opr11862.b1",  0x00000, 0x10000, 0xb6e94727 )
  5424.     ROM_LOAD( "opr11865.b5",  0x10000, 0x10000, 0x17e8d5d5 )
  5425.     ROM_LOAD( "opr11863.b2",  0x20000, 0x10000, 0x3e670098 )
  5426.     ROM_LOAD( "opr11866.b6",  0x30000, 0x10000, 0x50eb71cc )
  5427.     ROM_LOAD( "opr11864.b3",  0x40000, 0x10000, 0x05733ca8 )
  5428.     ROM_LOAD( "opr11867.b7",  0x50000, 0x10000, 0x81e49697 )
  5429.  
  5430.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  5431.     ROM_LOAD( "epr11857.a7",  0x00000, 0x08000, 0x789edc06 )
  5432.     ROM_LOAD( "epr11858.a8",  0x10000, 0x08000, 0x08ab0018 )
  5433.     ROM_LOAD( "epr11859.a9",  0x18000, 0x08000, 0x8673e01b )
  5434.     ROM_LOAD( "epr11860.a10", 0x20000, 0x08000, 0x10263746 )
  5435.     ROM_LOAD( "epr11861.a11", 0x28000, 0x08000, 0x38b54a71 )
  5436. ROM_END
  5437. /***************************************************************************/
  5438.  
  5439. static struct MemoryReadAddress passsht_readmem[] =
  5440. {
  5441.     { 0x000000, 0x01ffff, MRA_ROM },
  5442.     { 0x400000, 0x40ffff, MRA_TILERAM },
  5443.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  5444.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  5445.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  5446.     { 0xc41002, 0xc41003, io_player1_r },
  5447.     { 0xc41004, 0xc41005, io_player2_r },
  5448.     { 0xc41000, 0xc41001, io_service_r },
  5449.     { 0xc42002, 0xc42003, io_dip1_r },
  5450.     { 0xc42000, 0xc42001, io_dip2_r },
  5451.     { 0xc40000, 0xc40fff, MRA_EXTRAM },
  5452.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  5453.     {-1}
  5454. };
  5455.  
  5456. static struct MemoryWriteAddress passsht_writemem[] =
  5457. {
  5458.     { 0x000000, 0x01ffff, MWA_ROM },
  5459.     { 0x400000, 0x40ffff, MWA_TILERAM },
  5460.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  5461.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  5462.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  5463.     { 0xc42006, 0xc42007, sound_command_w },
  5464.     { 0xc40000, 0xc40fff, MWA_EXTRAM },
  5465.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  5466.     {-1}
  5467. };
  5468.  
  5469. static int passht4b_io1_val;
  5470. static int passht4b_io2_val;
  5471. static int passht4b_io3_val;
  5472.  
  5473. static READ_HANDLER( passht4b_service_r )
  5474. {
  5475.     int val=io_service_r(offset);
  5476.  
  5477.     if(!(io_player1_r(offset) & 0x40)) val&=0xef;
  5478.     if(!(io_player2_r(offset) & 0x40)) val&=0xdf;
  5479.     if(!(io_player3_r(offset) & 0x40)) val&=0xbf;
  5480.     if(!(io_player4_r(offset) & 0x40)) val&=0x7f;
  5481.  
  5482.     passht4b_io3_val=(io_player1_r(offset)<<4) | (io_player3_r(offset)&0xf);
  5483.     passht4b_io2_val=(io_player2_r(offset)<<4) | (io_player4_r(offset)&0xf);
  5484.  
  5485.     passht4b_io1_val=0xff;
  5486.  
  5487.     // player 1 buttons
  5488.     if(!(io_player1_r(offset) & 0x10)) passht4b_io1_val &=0xfe;
  5489.     if(!(io_player1_r(offset) & 0x20)) passht4b_io1_val &=0xfd;
  5490.     if(!(io_player1_r(offset) & 0x80)) passht4b_io1_val &=0xfc;
  5491.  
  5492.     // player 2 buttons
  5493.     if(!(io_player2_r(offset) & 0x10)) passht4b_io1_val &=0xfb;
  5494.     if(!(io_player2_r(offset) & 0x20)) passht4b_io1_val &=0xf7;
  5495.     if(!(io_player2_r(offset) & 0x80)) passht4b_io1_val &=0xf3;
  5496.  
  5497.     // player 3 buttons
  5498.     if(!(io_player3_r(offset) & 0x10)) passht4b_io1_val &=0xef;
  5499.     if(!(io_player3_r(offset) & 0x20)) passht4b_io1_val &=0xdf;
  5500.     if(!(io_player3_r(offset) & 0x80)) passht4b_io1_val &=0xcf;
  5501.  
  5502.     // player 4 buttons
  5503.     if(!(io_player4_r(offset) & 0x10)) passht4b_io1_val &=0xbf;
  5504.     if(!(io_player4_r(offset) & 0x20)) passht4b_io1_val &=0x7f;
  5505.     if(!(io_player4_r(offset) & 0x80)) passht4b_io1_val &=0x3f;
  5506.  
  5507.     return val;
  5508. }
  5509.  
  5510. static READ_HANDLER( passht4b_io1_r ) {    return passht4b_io1_val;}
  5511. static READ_HANDLER( passht4b_io2_r ) {    return passht4b_io2_val;}
  5512. static READ_HANDLER( passht4b_io3_r ) {    return passht4b_io3_val;}
  5513.  
  5514. static struct MemoryReadAddress passht4b_readmem[] =
  5515. {
  5516.     { 0x000000, 0x01ffff, MRA_ROM },
  5517.     { 0x400000, 0x40ffff, MRA_TILERAM },
  5518.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  5519.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  5520.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  5521.     { 0xc41000, 0xc41001, passht4b_service_r },
  5522.  
  5523.     { 0xc41002, 0xc41003, passht4b_io1_r },
  5524.     { 0xc41004, 0xc41005, passht4b_io2_r },
  5525.     { 0xc41006, 0xc41007, passht4b_io3_r },
  5526.  
  5527.     { 0xc42002, 0xc42003, io_dip1_r },
  5528.     { 0xc42000, 0xc42001, io_dip2_r },
  5529.     { 0xc43000, 0xc43001, io_player1_r },        // test mode only
  5530.     { 0xc43002, 0xc43003, io_player2_r },
  5531.     { 0xc43004, 0xc43005, io_player3_r },
  5532.     { 0xc43006, 0xc43007, io_player4_r },
  5533.     { 0xc4600a, 0xc4600b, MRA_EXTRAM },
  5534.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  5535.     {-1}
  5536. };
  5537.  
  5538. static struct MemoryWriteAddress passht4b_writemem[] =
  5539. {
  5540.     { 0x000000, 0x01ffff, MWA_ROM },
  5541.     { 0x400000, 0x40ffff, MWA_TILERAM },
  5542.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  5543.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  5544.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  5545.     { 0xc42006, 0xc42007, sound_command_w },
  5546.     { 0xc4600a, 0xc4600b, MWA_EXTRAM },
  5547.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  5548.     {-1}
  5549. };
  5550.  
  5551. /***************************************************************************/
  5552.  
  5553. static void passsht_update_proc( void ){
  5554.     sys16_fg_scrollx = READ_WORD( &sys16_workingram[0x34be] );
  5555.     sys16_bg_scrollx = READ_WORD( &sys16_workingram[0x34c2] );
  5556.     sys16_fg_scrolly = READ_WORD( &sys16_workingram[0x34bc] );
  5557.     sys16_bg_scrolly = READ_WORD( &sys16_workingram[0x34c0] );
  5558.  
  5559.     set_fg_page( READ_WORD( &sys16_textram[0x0ff6] ) );
  5560.     set_bg_page( READ_WORD( &sys16_textram[0x0ff4] ) );
  5561.     set_refresh( READ_WORD( &sys16_extraram[0] ) );
  5562. }
  5563.  
  5564. static void passht4b_update_proc( void ){
  5565.     sys16_fg_scrollx = READ_WORD( &sys16_workingram[0x34ce] );
  5566.     sys16_bg_scrollx = READ_WORD( &sys16_workingram[0x34d2] );
  5567.     sys16_fg_scrolly = READ_WORD( &sys16_workingram[0x34cc] );
  5568.     sys16_bg_scrolly = READ_WORD( &sys16_workingram[0x34d0] );
  5569.  
  5570.     set_fg_page( READ_WORD( &sys16_textram[0x0ff6] ) );
  5571.     set_bg_page( READ_WORD( &sys16_textram[0x0ff4] ) );
  5572.     set_refresh( READ_WORD( &sys16_extraram[0] ) );
  5573.  
  5574. }
  5575.  
  5576. static void passsht_init_machine( void ){
  5577.     static int bank[16] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,3 };
  5578.     sys16_obj_bank = bank;
  5579.  
  5580.     sys16_sprxoffset = -0x48;
  5581.     sys16_spritesystem = 0;
  5582.  
  5583.     // fix name entry
  5584.     patch_code( 0x13a8,0xc0);
  5585.  
  5586.     sys16_update_proc = passsht_update_proc;
  5587. }
  5588.  
  5589. static void passht4b_init_machine( void ){
  5590.     static int bank[16] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,3 };
  5591.     sys16_obj_bank = bank;
  5592.  
  5593.     sys16_sprxoffset = -0xb8;
  5594.     sys16_spritesystem = 8;
  5595.  
  5596.     // fix name entry
  5597.     patch_code( 0x138a,0xc0);
  5598.  
  5599.     sys16_update_proc = passht4b_update_proc;
  5600. }
  5601.  
  5602. static void init_passsht( void )
  5603. {
  5604.     sys16_onetime_init_machine();
  5605.     sys16_sprite_decode( 3,0x20000 );
  5606. }
  5607.  
  5608. static void init_passht4b( void ){
  5609.     int i;
  5610.  
  5611.     sys16_onetime_init_machine();
  5612.  
  5613.     /* invert the graphics bits on the tiles */
  5614.     for (i = 0; i < 0x30000; i++)
  5615.         memory_region(REGION_GFX1)[i] ^= 0xff;
  5616.  
  5617.     sys16_sprite_decode( 3,0x20000 );
  5618. }
  5619.  
  5620. /***************************************************************************/
  5621.  
  5622. INPUT_PORTS_START( passsht )
  5623. PORT_START /* joy 1 */
  5624.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 )
  5625.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
  5626.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )
  5627.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 )
  5628.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  5629.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  5630.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  5631.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  5632.  
  5633. PORT_START /* joy 2 */
  5634.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
  5635.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  5636.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  5637.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_COCKTAIL )
  5638.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  5639.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  5640.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  5641.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  5642.  
  5643.     SYS16_SERVICE
  5644.     SYS16_COINAGE
  5645.  
  5646. PORT_START    /* DSW1 */
  5647.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
  5648.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  5649.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  5650.     PORT_DIPNAME( 0x0e, 0x0e, "Initial Point" )
  5651.     PORT_DIPSETTING(    0x06, "2000" )
  5652.     PORT_DIPSETTING(    0x0a, "3000" )
  5653.     PORT_DIPSETTING(    0x0c, "4000" )
  5654.     PORT_DIPSETTING(    0x0e, "5000" )
  5655.     PORT_DIPSETTING(    0x08, "6000" )
  5656.     PORT_DIPSETTING(    0x04, "7000" )
  5657.     PORT_DIPSETTING(    0x02, "8000" )
  5658.     PORT_DIPSETTING(    0x00, "9000" )
  5659.     PORT_DIPNAME( 0x30, 0x30, "Point Table" )
  5660.     PORT_DIPSETTING(    0x20, "Easy" )
  5661.     PORT_DIPSETTING(    0x30, "Normal" )
  5662.     PORT_DIPSETTING(    0x10, "Hard" )
  5663.     PORT_DIPSETTING(    0x00, "Hardest" )
  5664.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
  5665.     PORT_DIPSETTING(    0x80, "Easy" )
  5666.     PORT_DIPSETTING(    0xc0, "Normal" )
  5667.     PORT_DIPSETTING(    0x40, "Hard" )
  5668.     PORT_DIPSETTING(    0x00, "Hardest" )
  5669. INPUT_PORTS_END
  5670.  
  5671. INPUT_PORTS_START( passht4b )
  5672. PORT_START /* joy 1 */
  5673.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  5674.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  5675.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  5676.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  5677.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  5678.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  5679.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
  5680.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )
  5681.  
  5682. PORT_START /* joy 2 */
  5683.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  5684.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  5685.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  5686.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  5687.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  5688.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  5689.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
  5690.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_COCKTAIL )
  5691.  
  5692. PORT_START /* service */
  5693.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  5694.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  5695.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  5696.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
  5697.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
  5698.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  5699.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 )
  5700.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
  5701.  
  5702.     SYS16_COINAGE
  5703.  
  5704. PORT_START    /* DSW1 */
  5705.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
  5706.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  5707.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  5708.     PORT_DIPNAME( 0x0e, 0x0e, "Initial Point" )
  5709.     PORT_DIPSETTING(    0x06, "2000" )
  5710.     PORT_DIPSETTING(    0x0a, "3000" )
  5711.     PORT_DIPSETTING(    0x0c, "4000" )
  5712.     PORT_DIPSETTING(    0x0e, "5000" )
  5713.     PORT_DIPSETTING(    0x08, "6000" )
  5714.     PORT_DIPSETTING(    0x04, "7000" )
  5715.     PORT_DIPSETTING(    0x02, "8000" )
  5716.     PORT_DIPSETTING(    0x00, "9000" )
  5717.     PORT_DIPNAME( 0x30, 0x30, "Point Table" )
  5718.     PORT_DIPSETTING(    0x20, "Easy" )
  5719.     PORT_DIPSETTING(    0x30, "Normal" )
  5720.     PORT_DIPSETTING(    0x10, "Hard" )
  5721.     PORT_DIPSETTING(    0x00, "Hardest" )
  5722.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
  5723.     PORT_DIPSETTING(    0x80, "Easy" )
  5724.     PORT_DIPSETTING(    0xc0, "Normal" )
  5725.     PORT_DIPSETTING(    0x40, "Hard" )
  5726.     PORT_DIPSETTING(    0x00, "Hardest" )
  5727.  
  5728. PORT_START /* joy 3 */
  5729.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER3 )
  5730.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER3 )
  5731.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 )
  5732.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER3 )
  5733.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  5734.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  5735.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
  5736.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER3 )
  5737.  
  5738. PORT_START /* joy 4 */
  5739.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER4 )
  5740.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER4 )
  5741.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER4 )
  5742.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER4 )
  5743.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER4 )
  5744.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
  5745.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
  5746.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER4 )
  5747.  
  5748. INPUT_PORTS_END
  5749.  
  5750. /***************************************************************************/
  5751.  
  5752. MACHINE_DRIVER_7759( machine_driver_passsht, \
  5753.     passsht_readmem,passsht_writemem,passsht_init_machine, gfx1 ,upd7759_interface)
  5754.  
  5755. MACHINE_DRIVER_7759( machine_driver_passht4b, \
  5756.     passht4b_readmem,passht4b_writemem,passht4b_init_machine, gfx1 ,upd7759_interface)
  5757.  
  5758. /***************************************************************************/
  5759. // pre16
  5760. ROM_START( quartet )
  5761.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  5762.     ROM_LOAD_EVEN( "epr7458a.9b",  0x000000, 0x8000, 0x42e7b23e )
  5763.     ROM_LOAD_ODD ( "epr7455a.6b",  0x000000, 0x8000, 0x01631ab2 )
  5764.     ROM_LOAD_EVEN( "epr7459a.10b", 0x010000, 0x8000, 0x6b540637 )
  5765.     ROM_LOAD_ODD ( "epr7456a.7b",  0x010000, 0x8000, 0x31ca583e )
  5766.     ROM_LOAD_EVEN( "epr7460.11b",  0x020000, 0x8000, 0xa444ea13 )
  5767.     ROM_LOAD_ODD ( "epr7457.8b",   0x020000, 0x8000, 0x3b282c23 )
  5768.  
  5769.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  5770.     ROM_LOAD( "epr7461.9c",  0x00000, 0x08000, 0xf6af07f2 )
  5771.     ROM_LOAD( "epr7462.10c", 0x08000, 0x08000, 0x7914af28 )
  5772.     ROM_LOAD( "epr7463.11c", 0x10000, 0x08000, 0x827c5603 )
  5773.  
  5774.     ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites  - the same as quartet 2 */
  5775.     ROM_LOAD( "epr7465.5c",  0x000000, 0x008000, 0x8a1ab7d7 )
  5776.     ROM_RELOAD(              0x040000, 0x008000 ) //twice? - fixes a sprite glitch
  5777.     ROM_LOAD( "epr-7469.2b", 0x008000, 0x008000, 0xcb65ae4f )
  5778.     ROM_RELOAD(              0x048000, 0x008000 ) //twice?
  5779.     ROM_LOAD( "epr7466.6c",  0x010000, 0x008000, 0xb2d3f4f3 )
  5780.     ROM_LOAD( "epr-7470.3b", 0x018000, 0x008000, 0x16fc67b1 )
  5781.     ROM_LOAD( "epr7467.7c",  0x020000, 0x008000, 0x0af68de2 )
  5782.     ROM_LOAD( "epr-7471.4b", 0x028000, 0x008000, 0x13fad5ac )
  5783.     ROM_LOAD( "epr7468.8c",  0x030000, 0x008000, 0xddfd40c0 )
  5784.     ROM_LOAD( "epr-7472.5b", 0x038000, 0x008000, 0x8e2762ec )
  5785.  
  5786.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  5787.     ROM_LOAD( "epr-7464.1b", 0x0000, 0x8000, 0x9f291306 )
  5788.  
  5789.     ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
  5790.     ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
  5791.  
  5792.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
  5793.     ROM_LOAD( "epr7473.1c", 0x00000, 0x8000, 0x06ec75fa )
  5794.     ROM_LOAD( "epr7475.2c", 0x08000, 0x8000, 0x7abd1206 )
  5795.     ROM_LOAD( "epr7474.3c", 0x10000, 0x8000, 0xdbf853b8 )
  5796.     ROM_LOAD( "epr7476.4c", 0x18000, 0x8000, 0x5eba655a )
  5797. ROM_END
  5798.  
  5799. ROM_START( quartetj )
  5800.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  5801.     ROM_LOAD_EVEN( "epr-7458.43",  0x000000, 0x8000, 0x0096499f )
  5802.     ROM_LOAD_ODD ( "epr-7455.26",  0x000000, 0x8000, 0xda934390 )
  5803.     ROM_LOAD_EVEN( "epr-7459.42",  0x010000, 0x8000, 0xd130cf61 )
  5804.     ROM_LOAD_ODD ( "epr-7456.25",  0x010000, 0x8000, 0x7847149f )
  5805.     ROM_LOAD_EVEN( "epr7460.11b",  0x020000, 0x8000, 0xa444ea13 )
  5806.     ROM_LOAD_ODD ( "epr7457.8b",   0x020000, 0x8000, 0x3b282c23 )
  5807.  
  5808.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  5809.     ROM_LOAD( "epr7461.9c",  0x00000, 0x08000, 0xf6af07f2 )
  5810.     ROM_LOAD( "epr7462.10c", 0x08000, 0x08000, 0x7914af28 )
  5811.     ROM_LOAD( "epr7463.11c", 0x10000, 0x08000, 0x827c5603 )
  5812.  
  5813.     ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites  - the same as quartet 2 */
  5814.     ROM_LOAD( "epr7465.5c",  0x000000, 0x008000, 0x8a1ab7d7 )
  5815.     ROM_RELOAD(              0x040000, 0x008000 ) //twice? - fixes a sprite glitch
  5816.     ROM_LOAD( "epr-7469.2b", 0x008000, 0x008000, 0xcb65ae4f )
  5817.     ROM_RELOAD(              0x048000, 0x008000 ) //twice?
  5818.     ROM_LOAD( "epr7466.6c",  0x010000, 0x008000, 0xb2d3f4f3 )
  5819.     ROM_LOAD( "epr-7470.3b", 0x018000, 0x008000, 0x16fc67b1 )
  5820.     ROM_LOAD( "epr7467.7c",  0x020000, 0x008000, 0x0af68de2 )
  5821.     ROM_LOAD( "epr-7471.4b", 0x028000, 0x008000, 0x13fad5ac )
  5822.     ROM_LOAD( "epr7468.8c",  0x030000, 0x008000, 0xddfd40c0 )
  5823.     ROM_LOAD( "epr-7472.5b", 0x038000, 0x008000, 0x8e2762ec )
  5824.  
  5825.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  5826.     ROM_LOAD( "epr-7464.1b", 0x0000, 0x8000, 0x9f291306 )
  5827.  
  5828.     ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
  5829.     ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
  5830.  
  5831.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
  5832.     ROM_LOAD( "epr7473.1c", 0x00000, 0x8000, 0x06ec75fa )
  5833.     ROM_LOAD( "epr7475.2c", 0x08000, 0x8000, 0x7abd1206 )
  5834.     ROM_LOAD( "epr7474.3c", 0x10000, 0x8000, 0xdbf853b8 )
  5835.     ROM_LOAD( "epr7476.4c", 0x18000, 0x8000, 0x5eba655a )
  5836. ROM_END
  5837.  
  5838.  
  5839. /***************************************************************************/
  5840.  
  5841. static READ_HANDLER( quartet_skip_r )
  5842. {
  5843.     if (cpu_get_pc()==0x89b2) {cpu_spinuntil_int(); return 0xffff;}
  5844.  
  5845.     return READ_WORD(&sys16_workingram[0x0800]);
  5846. }
  5847.  
  5848. static READ_HANDLER( io_quartet_p1_r ) {return input_port_0_r( offset );}
  5849. static READ_HANDLER( io_quartet_p2_r ) {return input_port_1_r( offset );}
  5850. static READ_HANDLER( io_quartet_p3_r ) {return input_port_2_r( offset );}
  5851. static READ_HANDLER( io_quartet_p4_r ) {return input_port_3_r( offset );}
  5852. static READ_HANDLER( io_quartet_dip1_r ) {return input_port_4_r( offset );}
  5853. static READ_HANDLER( io_quartet_dip2_r ) {return input_port_5_r( offset );}
  5854.  
  5855. static struct MemoryReadAddress quartet_readmem[] =
  5856. {
  5857.     { 0x000000, 0x02ffff, MRA_ROM },
  5858.     { 0x400000, 0x40ffff, MRA_TILERAM },
  5859.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  5860.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  5861.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  5862.     { 0xc41000, 0xc41001, io_quartet_p1_r },
  5863.     { 0xc41002, 0xc41003, io_quartet_p2_r },
  5864.     { 0xc41004, 0xc41005, io_quartet_p3_r },
  5865.     { 0xc41006, 0xc41007, io_quartet_p4_r },
  5866.     { 0xc42000, 0xc42001, io_quartet_dip1_r },
  5867.     { 0xc42002, 0xc42003, io_quartet_dip2_r },
  5868.     { 0xc40000, 0xc4ffff, MRA_EXTRAM },
  5869.     { 0xffc800, 0xffc801, quartet_skip_r },
  5870.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  5871.     {-1}
  5872. };
  5873.  
  5874. static struct MemoryWriteAddress quartet_writemem[] =
  5875. {
  5876.     { 0x000000, 0x02ffff, MWA_ROM },
  5877.     { 0x400000, 0x40ffff, MWA_TILERAM },
  5878.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  5879.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  5880.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  5881.     { 0xc40000, 0xc40001, sound_command_nmi_w },
  5882.     { 0xc40000, 0xc4ffff, MWA_EXTRAM },
  5883.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  5884.     {-1}
  5885. };
  5886. /***************************************************************************/
  5887.  
  5888. static void quartet_update_proc( void ){
  5889.     sys16_fg_scrollx = READ_WORD( &sys16_workingram[0x0d14] ) & 0x01ff;
  5890.     sys16_bg_scrollx = READ_WORD( &sys16_workingram[0x0d18] ) & 0x01ff;
  5891.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
  5892.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
  5893.  
  5894.     if((READ_WORD(&sys16_extraram[4]) & 0xff) == 1)
  5895.         sys16_quartet_title_kludge=1;
  5896.     else
  5897.         sys16_quartet_title_kludge=0;
  5898.  
  5899.     set_fg_page1( READ_WORD( &sys16_workingram[0x0d1c] ) );
  5900.     set_bg_page1( READ_WORD( &sys16_workingram[0x0d1e] ) );
  5901.  
  5902.     set_refresh_3d( READ_WORD( &sys16_extraram[2] ) );
  5903. }
  5904.  
  5905. static void quartet_init_machine( void ){
  5906.     static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
  5907.     sys16_obj_bank = bank;
  5908.     sys16_textmode=1;
  5909.     sys16_spritesystem = 2;
  5910.     sys16_sprxoffset = -0xbc;
  5911.     sys16_fgxoffset = sys16_bgxoffset = 7;
  5912.  
  5913.     sys16_update_proc = quartet_update_proc;
  5914. }
  5915.  
  5916. static void init_quartet( void )
  5917. {
  5918.     sys16_onetime_init_machine();
  5919.     sys16_sprite_decode( 5,0x010000 );
  5920. }
  5921. /***************************************************************************/
  5922.  
  5923. INPUT_PORTS_START( quartet )
  5924.     // Player 1
  5925.     PORT_START
  5926.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY  )
  5927.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  | IPF_8WAY  )
  5928.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  5929.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  5930.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  5931.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
  5932.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  5933.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  5934.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* player 1 coin 2 really */
  5935.     // Player 2
  5936.     PORT_START
  5937.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY  | IPF_PLAYER2 )
  5938.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  | IPF_8WAY  | IPF_PLAYER2 )
  5939.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2)
  5940.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2)
  5941.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2)
  5942.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  5943.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2)
  5944.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
  5945.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* player 2 coin 2 really */
  5946.     // Player 3
  5947.     PORT_START
  5948.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER3  )
  5949.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  | IPF_8WAY  | IPF_PLAYER3 )
  5950.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 )
  5951.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER3 )
  5952.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  5953.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START3 )
  5954.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  5955.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
  5956.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* player 3 coin 2 really */
  5957.     // Player 4
  5958.     PORT_START
  5959.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY  | IPF_PLAYER4 )
  5960.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  | IPF_8WAY  | IPF_PLAYER4 )
  5961.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER4)
  5962.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER4)
  5963.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4)
  5964.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START4 )
  5965.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4)
  5966.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN4 )
  5967.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* player 4 coin 2 really */
  5968.  
  5969.     SYS16_COINAGE
  5970.  
  5971.     PORT_START    /* DSW1 */
  5972.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
  5973.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  5974.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  5975.     PORT_DIPNAME( 0x06, 0x00, "Credit Power" )
  5976.     PORT_DIPSETTING(    0x04, "500" )
  5977.     PORT_DIPSETTING(    0x06, "1000" )
  5978.     PORT_DIPSETTING(    0x02, "2000" )
  5979.     PORT_DIPSETTING(    0x00, "9000" )
  5980.     PORT_DIPNAME( 0x18, 0x00, DEF_STR( Difficulty ) )
  5981.     PORT_DIPSETTING(    0x10, "Easy" )
  5982.     PORT_DIPSETTING(    0x18, "Normal" )
  5983.     PORT_DIPSETTING(    0x08, "Hard" )
  5984.     PORT_DIPSETTING(    0x00, "Hardest" )
  5985.     PORT_DIPNAME( 0x20, 0x20, "Coin During Game" )
  5986.     PORT_DIPSETTING(    0x20, "Power" )
  5987.     PORT_DIPSETTING(    0x00, "Credit" )
  5988.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
  5989.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  5990.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  5991.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  5992. INPUT_PORTS_END
  5993.  
  5994. /***************************************************************************/
  5995.  
  5996. MACHINE_DRIVER_7751( machine_driver_quartet, \
  5997.     quartet_readmem,quartet_writemem,quartet_init_machine, gfx8 )
  5998.  
  5999. /***************************************************************************/
  6000. // pre16
  6001. ROM_START( quartet2 )
  6002.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  6003.     ROM_LOAD_EVEN( "quartet2.b9",  0x000000, 0x8000, 0x67177cd8 )
  6004.     ROM_LOAD_ODD ( "quartet2.b6",  0x000000, 0x8000, 0x50f50b08 )
  6005.     ROM_LOAD_EVEN( "quartet2.b10", 0x010000, 0x8000, 0x4273c3b7 )
  6006.     ROM_LOAD_ODD ( "quartet2.b7",  0x010000, 0x8000, 0x0aa337bb )
  6007.     ROM_LOAD_EVEN( "quartet2.b11", 0x020000, 0x8000, 0x3a6a375d )
  6008.     ROM_LOAD_ODD ( "quartet2.b8",  0x020000, 0x8000, 0xd87b2ca2 )
  6009.  
  6010.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  6011.     ROM_LOAD( "quartet2.c9",  0x00000, 0x08000, 0x547a6058 )
  6012.     ROM_LOAD( "quartet2.c10", 0x08000, 0x08000, 0x77ec901d )
  6013.     ROM_LOAD( "quartet2.c11", 0x10000, 0x08000, 0x7e348cce )
  6014.  
  6015.     ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites */
  6016.     ROM_LOAD( "epr7465.5c",  0x000000, 0x008000, 0x8a1ab7d7 )
  6017.     ROM_RELOAD(              0x040000, 0x008000 ) //twice? - fixes a sprite glitch
  6018.     ROM_LOAD( "epr-7469.2b", 0x008000, 0x008000, 0xcb65ae4f )
  6019.     ROM_RELOAD(              0x048000, 0x008000 ) //twice?
  6020.     ROM_LOAD( "epr7466.6c",  0x010000, 0x008000, 0xb2d3f4f3 )
  6021.     ROM_LOAD( "epr-7470.3b", 0x018000, 0x008000, 0x16fc67b1 )
  6022.     ROM_LOAD( "epr7467.7c",  0x020000, 0x008000, 0x0af68de2 )
  6023.     ROM_LOAD( "epr-7471.4b", 0x028000, 0x008000, 0x13fad5ac )
  6024.     ROM_LOAD( "epr7468.8c",  0x030000, 0x008000, 0xddfd40c0 )
  6025.     ROM_LOAD( "epr-7472.5b", 0x038000, 0x008000, 0x8e2762ec )
  6026.  
  6027.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  6028.     ROM_LOAD( "epr-7464.1b", 0x0000, 0x8000, 0x9f291306 )
  6029.  
  6030.     ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
  6031.     ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
  6032.  
  6033.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
  6034.     ROM_LOAD( "epr7473.1c", 0x00000, 0x8000, 0x06ec75fa )
  6035.     ROM_LOAD( "epr7475.2c", 0x08000, 0x8000, 0x7abd1206 )
  6036.     ROM_LOAD( "epr7474.3c", 0x10000, 0x8000, 0xdbf853b8 )
  6037.     ROM_LOAD( "epr7476.4c", 0x18000, 0x8000, 0x5eba655a )
  6038. ROM_END
  6039.  
  6040. /***************************************************************************/
  6041.  
  6042. static READ_HANDLER( quartet2_skip_r )
  6043. {
  6044.     if (cpu_get_pc()==0x8f6c) {cpu_spinuntil_int(); return 0xffff;}
  6045.  
  6046.     return READ_WORD(&sys16_workingram[0x0800]);
  6047. }
  6048.  
  6049. static struct MemoryReadAddress quartet2_readmem[] =
  6050. {
  6051.     { 0x000000, 0x02ffff, MRA_ROM },
  6052.     { 0x400000, 0x40ffff, MRA_TILERAM },
  6053.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  6054.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  6055.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  6056.     { 0xc41002, 0xc41003, io_player1_r },
  6057.     { 0xc41006, 0xc41007, io_player2_r },
  6058.     { 0xc41000, 0xc41001, io_service_r },
  6059.     { 0xc42000, 0xc42001, io_dip1_r },
  6060.     { 0xc42002, 0xc42003, io_dip2_r },
  6061.     { 0xc40000, 0xc4ffff, MRA_EXTRAM },
  6062.     { 0xffc800, 0xffc801, quartet2_skip_r },
  6063.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  6064.     {-1}
  6065. };
  6066.  
  6067. static struct MemoryWriteAddress quartet2_writemem[] =
  6068. {
  6069.     { 0x000000, 0x02ffff, MWA_ROM },
  6070.     { 0x400000, 0x40ffff, MWA_TILERAM },
  6071.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  6072.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  6073.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  6074.     { 0xc40000, 0xc40001, sound_command_nmi_w },
  6075.     { 0xc40000, 0xc4ffff, MWA_EXTRAM },
  6076.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  6077.     {-1}
  6078. };
  6079. /***************************************************************************/
  6080.  
  6081. static void quartet2_update_proc( void ){
  6082.     sys16_fg_scrollx = READ_WORD( &sys16_workingram[0x0d14] ) & 0x01ff;
  6083.     sys16_bg_scrollx = READ_WORD( &sys16_workingram[0x0d18] ) & 0x01ff;
  6084.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
  6085.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
  6086.  
  6087.     if((READ_WORD(&sys16_extraram[4]) & 0xff) == 1)
  6088.         sys16_quartet_title_kludge=1;
  6089.     else
  6090.         sys16_quartet_title_kludge=0;
  6091.  
  6092.     set_fg_page1( READ_WORD( &sys16_workingram[0x0d1c] ) );
  6093.     set_bg_page1( READ_WORD( &sys16_workingram[0x0d1e] ) );
  6094.  
  6095.     set_refresh_3d( READ_WORD( &sys16_extraram[2] ) );
  6096. }
  6097.  
  6098. static void quartet2_init_machine( void ){
  6099.     static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
  6100.     sys16_obj_bank = bank;
  6101.     sys16_textmode=1;
  6102.     sys16_spritesystem = 2;
  6103.     sys16_sprxoffset = -0xbc;
  6104.     sys16_fgxoffset = sys16_bgxoffset = 7;
  6105.  
  6106.     sys16_update_proc = quartet2_update_proc;
  6107. }
  6108.  
  6109. static void init_quartet2( void )
  6110. {
  6111.     sys16_onetime_init_machine();
  6112.     sys16_sprite_decode( 5,0x010000 );
  6113. }
  6114. /***************************************************************************/
  6115.  
  6116. INPUT_PORTS_START( quartet2 )
  6117.     SYS16_JOY1_SWAPPEDBUTTONS
  6118.     SYS16_JOY2_SWAPPEDBUTTONS
  6119.     SYS16_SERVICE
  6120.     SYS16_COINAGE
  6121.  
  6122. PORT_START    /* DSW1 */
  6123.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
  6124.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  6125.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  6126.     PORT_DIPNAME( 0x06, 0x00, "Credit Power" )
  6127.     PORT_DIPSETTING(    0x04, "500" )
  6128.     PORT_DIPSETTING(    0x06, "1000" )
  6129.     PORT_DIPSETTING(    0x02, "2000" )
  6130.     PORT_DIPSETTING(    0x00, "9000" )
  6131.     PORT_DIPNAME( 0x18, 0x00, DEF_STR( Difficulty ) )
  6132.     PORT_DIPSETTING(    0x10, "Easy" )
  6133.     PORT_DIPSETTING(    0x18, "Normal" )
  6134.     PORT_DIPSETTING(    0x08, "Hard" )
  6135.     PORT_DIPSETTING(    0x00, "Hardest" )
  6136.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
  6137.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  6138.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  6139.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
  6140.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  6141.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  6142.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
  6143.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  6144.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  6145.  
  6146. INPUT_PORTS_END
  6147.  
  6148. /***************************************************************************/
  6149.  
  6150. MACHINE_DRIVER_7751( machine_driver_quartet2, \
  6151.     quartet2_readmem,quartet2_writemem,quartet2_init_machine, gfx8 )
  6152.  
  6153. /***************************************************************************
  6154.  
  6155.    Riot City
  6156.  
  6157. ***************************************************************************/
  6158. // sys16B
  6159. ROM_START( riotcity )
  6160.     ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
  6161.     ROM_LOAD_EVEN( "epr14612.bin", 0x000000, 0x20000, 0xa1b331ec )
  6162.     ROM_LOAD_ODD ( "epr14610.bin", 0x000000, 0x20000, 0xcd4f2c50 )
  6163.     /* empty 0x40000 - 0x80000 */
  6164.     ROM_LOAD_EVEN( "epr14613.bin", 0x080000, 0x20000, 0x0659df4c )
  6165.     ROM_LOAD_ODD ( "epr14611.bin", 0x080000, 0x20000, 0xd9e6f80b )
  6166.  
  6167.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  6168.     ROM_LOAD( "epr14616.bin", 0x00000, 0x20000, 0x46d30368 ) /* plane 1 */
  6169.     ROM_LOAD( "epr14625.bin", 0x20000, 0x20000, 0xabfb80fe )
  6170.     ROM_LOAD( "epr14617.bin", 0x40000, 0x20000, 0x884e40f9 ) /* plane 2 */
  6171.     ROM_LOAD( "epr14626.bin", 0x60000, 0x20000, 0x4ef55846 )
  6172.     ROM_LOAD( "epr14618.bin", 0x80000, 0x20000, 0x00eb260e ) /* plane 3 */
  6173.     ROM_LOAD( "epr14627.bin", 0xa0000, 0x20000, 0x961e5f82 )
  6174.  
  6175.     ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
  6176.     ROM_LOAD( "epr14619.bin",  0x000000, 0x040000, 0x6f2b5ef7 )
  6177.     ROM_LOAD( "epr14622.bin",  0x040000, 0x040000, 0x7ca7e40d )
  6178.     ROM_LOAD( "epr14620.bin",  0x080000, 0x040000, 0x66183333 )
  6179.     ROM_LOAD( "epr14623.bin",  0x0c0000, 0x040000, 0x98630049 )
  6180.     ROM_LOAD( "epr14621.bin",  0x100000, 0x040000, 0xc0f2820e )
  6181.     ROM_LOAD( "epr14624.bin",  0x140000, 0x040000, 0xd1a68448 )
  6182.  
  6183.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  6184.     ROM_LOAD( "epr14614.bin", 0x00000, 0x10000, 0xc65cc69a )
  6185.     ROM_LOAD( "epr14615.bin", 0x10000, 0x20000, 0x46653db1 )
  6186. ROM_END
  6187.  
  6188. /***************************************************************************/
  6189.  
  6190. static READ_HANDLER( riotcity_skip_r )
  6191. {
  6192.     if (cpu_get_pc()==0x3ce) {cpu_spinuntil_int(); return 0;}
  6193.  
  6194.     return READ_WORD(&sys16_workingram[0x2cde]);
  6195. }
  6196.  
  6197. static struct MemoryReadAddress riotcity_readmem[] =
  6198. {
  6199.     { 0x000000, 0x0bffff, MRA_ROM },
  6200.     { 0x3f0000, 0x3fffff, MRA_EXTRAM },
  6201.     { 0xf20000, 0xf20fff, MRA_EXTRAM3 },
  6202.     { 0xf40000, 0xf40fff, MRA_SPRITERAM },
  6203.     { 0xf60000, 0xf60fff, MRA_PALETTERAM },
  6204.     { 0xf81002, 0xf81003, io_player1_r },
  6205.     { 0xf81006, 0xf81007, io_player2_r },
  6206.     { 0xf81000, 0xf81001, io_service_r },
  6207.     { 0xf82002, 0xf82003, io_dip1_r },
  6208.     { 0xf82000, 0xf82001, io_dip2_r },
  6209.     { 0xf80000, 0xf8ffff, MRA_EXTRAM2 },
  6210.     { 0xfa0000, 0xfaffff, MRA_TILERAM },
  6211.     { 0xfb0000, 0xfb0fff, MRA_TEXTRAM },
  6212.     { 0xffecde, 0xffecdf, riotcity_skip_r },
  6213.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  6214.     {-1}
  6215. };
  6216.  
  6217. static struct MemoryWriteAddress riotcity_writemem[] =
  6218. {
  6219.     { 0x000000, 0x0bffff, MWA_ROM },
  6220.     { 0x3f0000, 0x3fffff, MWA_EXTRAM },
  6221.     { 0xf00006, 0xf00007, sound_command_w },
  6222.     { 0xf20000, 0xf20fff, MWA_EXTRAM3 },
  6223.     { 0xf40000, 0xf40fff, MWA_SPRITERAM },
  6224.     { 0xf60000, 0xf60fff, MWA_PALETTERAM },
  6225.     { 0xf80000, 0xf8ffff, MWA_EXTRAM2 },
  6226.     { 0xfa0000, 0xfaffff, MWA_TILERAM },
  6227.     { 0xfb0000, 0xfb0fff, MWA_TEXTRAM },
  6228.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  6229.     {-1}
  6230. };
  6231. /***************************************************************************/
  6232.  
  6233. static void riotcity_update_proc (void)
  6234. {
  6235.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  6236.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  6237.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  6238.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  6239.  
  6240.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  6241.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  6242.  
  6243.     sys16_tile_bank1 = READ_WORD( &sys16_extraram3[0x0002] ) & 0xf;
  6244.     sys16_tile_bank0 = READ_WORD( &sys16_extraram3[0x0000] ) & 0xf;
  6245.  
  6246.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  6247. }
  6248.  
  6249. static void riotcity_init_machine( void ){
  6250.     static int bank[16] = {0x00,0x02,0x08,0x0A,0x10,0x12,0x00,0x00,0x04,0x06,0x0C,0x0E,0x14,0x16,0x00,0x00};
  6251.  
  6252.     sys16_obj_bank = bank;
  6253.     sys16_spritesystem = 4;
  6254.     sys16_spritelist_end=0x8000;
  6255.     sys16_bg_priority_mode=1;
  6256.  
  6257.     sys16_update_proc = riotcity_update_proc;
  6258. }
  6259.  
  6260. static void init_riotcity(void)
  6261. {
  6262.     sys16_onetime_init_machine();
  6263.     sys16_sprite_decode (3,0x80000);
  6264. }
  6265.  
  6266. /***************************************************************************/
  6267.  
  6268. INPUT_PORTS_START( riotcity )
  6269.     SYS16_JOY1
  6270.     SYS16_JOY2
  6271.     SYS16_SERVICE
  6272.     SYS16_COINAGE
  6273.  
  6274. PORT_START    /* DSW1 */
  6275.     PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
  6276.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  6277.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  6278.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  6279.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  6280.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  6281.     PORT_DIPNAME( 0x0c, 0x08, DEF_STR( Lives ) )
  6282.     PORT_DIPSETTING(    0x00, "1" )
  6283.     PORT_DIPSETTING(    0x0c, "2" )
  6284.     PORT_DIPSETTING(    0x08, "3" )
  6285.     PORT_DIPSETTING(    0x04, "4" )
  6286.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )
  6287.     PORT_DIPSETTING(    0x20, "Easy" )
  6288.     PORT_DIPSETTING(    0x30, "Normal" )
  6289.     PORT_DIPSETTING(    0x10, "Hard" )
  6290.     PORT_DIPSETTING(    0x00, "Hardest" )
  6291.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) )
  6292.     PORT_DIPSETTING(    0x40, "Normal" )
  6293.     PORT_DIPSETTING(    0x00, "Hard" )
  6294.     PORT_DIPNAME( 0x80, 0x80, "Attack Button to Start" )
  6295.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  6296.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  6297. INPUT_PORTS_END
  6298.  
  6299. /***************************************************************************/
  6300.  
  6301. MACHINE_DRIVER_7759( machine_driver_riotcity, \
  6302.     riotcity_readmem,riotcity_writemem,riotcity_init_machine, gfx4,upd7759_interface )
  6303.  
  6304. /***************************************************************************/
  6305. // sys16B
  6306. ROM_START( sdi )
  6307.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  6308.     ROM_LOAD_EVEN( "a4.rom", 0x000000, 0x8000, 0xf2c41dd6 )
  6309.     ROM_LOAD_ODD ( "a1.rom", 0x000000, 0x8000, 0xa9f816ef )
  6310.     ROM_LOAD_EVEN( "a5.rom", 0x010000, 0x8000, 0x7952e27e )
  6311.     ROM_LOAD_ODD ( "a2.rom", 0x010000, 0x8000, 0x369af326 )
  6312.     ROM_LOAD_EVEN( "a6.rom", 0x020000, 0x8000, 0x8ee2c287 )
  6313.     ROM_LOAD_ODD ( "a3.rom", 0x020000, 0x8000, 0x193e4231 )
  6314.  
  6315.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  6316.     ROM_LOAD( "b9.rom",  0x00000, 0x10000, 0x182b6301 )
  6317.     ROM_LOAD( "b10.rom", 0x10000, 0x10000, 0x8f7129a2 )
  6318.     ROM_LOAD( "b11.rom", 0x20000, 0x10000, 0x4409411f )
  6319.  
  6320.     ROM_REGION( 0x060000*2, REGION_GFX2 ) /* sprites */
  6321.     ROM_LOAD( "b1.rom", 0x000000, 0x010000, 0x30e2c50a )
  6322.     ROM_LOAD( "b5.rom", 0x010000, 0x010000, 0x794e3e8b )
  6323.     ROM_LOAD( "b2.rom", 0x020000, 0x010000, 0x6a8b3fd0 )
  6324.     ROM_LOAD( "b6.rom", 0x030000, 0x010000, 0x602da5d5 )
  6325.     ROM_LOAD( "b3.rom", 0x040000, 0x010000, 0xb9de3aeb )
  6326.     ROM_LOAD( "b7.rom", 0x050000, 0x010000, 0x0a73a057 )
  6327.  
  6328.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  6329.     ROM_LOAD( "a7.rom", 0x0000, 0x8000, 0x793f9f7f )
  6330. ROM_END
  6331.  
  6332. // sys16A
  6333. ROM_START( sdioj )
  6334.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  6335. // Custom cpu 317-0027
  6336.     ROM_LOAD_EVEN( "epr10970.43", 0x000000, 0x8000, 0xb8fa4a2c )
  6337.     ROM_LOAD_ODD ( "epr10968.26", 0x000000, 0x8000, 0xa3f97793 )
  6338.     ROM_LOAD_EVEN( "epr10971.42", 0x010000, 0x8000, 0xc44a0328 )
  6339.     ROM_LOAD_ODD ( "epr10969.25", 0x010000, 0x8000, 0x455d15bd )
  6340.     ROM_LOAD_EVEN( "epr10755.41", 0x020000, 0x8000, 0x405e3969 )
  6341.     ROM_LOAD_ODD ( "epr10752.24", 0x020000, 0x8000, 0x77453740 )
  6342.  
  6343.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  6344.     ROM_LOAD( "epr10756.95", 0x00000, 0x10000, 0x44d8a506 )
  6345.     ROM_LOAD( "epr10757.94", 0x10000, 0x10000, 0x497e1740 )
  6346.     ROM_LOAD( "epr10758.93", 0x20000, 0x10000, 0x61d61486 )
  6347.  
  6348.     ROM_REGION( 0x060000*2, REGION_GFX2 ) /* sprites */
  6349.     ROM_LOAD( "b1.rom", 0x000000, 0x010000, 0x30e2c50a )
  6350.     ROM_LOAD( "b5.rom", 0x010000, 0x010000, 0x794e3e8b )
  6351.     ROM_LOAD( "b2.rom", 0x020000, 0x010000, 0x6a8b3fd0 )
  6352.     ROM_LOAD( "b6.rom", 0x030000, 0x010000, 0x602da5d5 )
  6353.     ROM_LOAD( "b3.rom", 0x040000, 0x010000, 0xb9de3aeb )
  6354.     ROM_LOAD( "b7.rom", 0x050000, 0x010000, 0x0a73a057 )
  6355.  
  6356.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  6357.     ROM_LOAD( "epr10759.12", 0x0000, 0x8000, 0xd7f9649f )
  6358. ROM_END
  6359.  
  6360.  
  6361. /***************************************************************************/
  6362.  
  6363. static READ_HANDLER( io_p1mousex_r ){ return 0xff-input_port_5_r( offset ); }
  6364. static READ_HANDLER( io_p1mousey_r ){ return input_port_6_r( offset ); }
  6365.  
  6366. static READ_HANDLER( io_p2mousex_r ){ return input_port_7_r( offset ); }
  6367. static READ_HANDLER( io_p2mousey_r ){ return input_port_8_r( offset ); }
  6368.  
  6369. static READ_HANDLER( sdi_skip_r )
  6370. {
  6371.     if (cpu_get_pc()==0x5326) {cpu_spinuntil_int(); return 0xffff;}
  6372.  
  6373.     return READ_WORD(&sys16_workingram[0x0400]);
  6374. }
  6375.  
  6376. static struct MemoryReadAddress sdi_readmem[] =
  6377. {
  6378.     { 0x000000, 0x02ffff, MRA_ROM },
  6379.     { 0x400000, 0x40ffff, MRA_TILERAM },
  6380.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  6381.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  6382.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  6383.     { 0xc40000, 0xc40001, MRA_EXTRAM },
  6384.     { 0xc41004, 0xc41005, io_player1_r },
  6385.     { 0xc41002, 0xc41003, io_player2_r },
  6386.     { 0xc41000, 0xc41001, io_service_r },
  6387.     { 0xc42000, 0xc42001, io_dip2_r },
  6388.     { 0xc42002, 0xc42003, io_dip1_r },
  6389.     { 0xc42004, 0xc42005, io_dip2_r },
  6390.     { 0xc43000, 0xc43001, io_p1mousex_r },
  6391.     { 0xc43004, 0xc43005, io_p1mousey_r },
  6392.     { 0xc43008, 0xc43009, io_p2mousex_r },
  6393.     { 0xc4300c, 0xc4300d, io_p2mousey_r },
  6394. //    { 0xc42000, 0xc42001, MRA_NOP }, /* What is this? */
  6395.     { 0xc60000, 0xc60001, MRA_NOP }, /* What is this? */
  6396.     { 0xffc400, 0xffc401, sdi_skip_r },
  6397.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  6398.     {-1}
  6399. };
  6400.  
  6401. static struct MemoryWriteAddress sdi_writemem[] =
  6402. {
  6403.     { 0x000000, 0x02ffff, MWA_ROM },
  6404.     { 0x123406, 0x123407, sound_command_w },
  6405.     { 0x400000, 0x40ffff, MWA_TILERAM },
  6406.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  6407.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  6408.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  6409.     { 0xc40000, 0xc40001, MWA_EXTRAM },
  6410.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  6411.     {-1}
  6412. };
  6413. /***************************************************************************/
  6414.  
  6415. static void sdi_update_proc( void ){
  6416.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  6417.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  6418.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  6419.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  6420.  
  6421.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  6422.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  6423.  
  6424.     set_refresh( READ_WORD( &sys16_extraram[0] ) );
  6425. }
  6426.  
  6427. static void sdi_init_machine( void ){
  6428.     static int bank[16] = {00,00,00,00,00,00,00,0x06,00,00,00,0x04,00,0x02,00,00};
  6429.  
  6430.     sys16_obj_bank = bank;
  6431.  
  6432.     // ??
  6433.     patch_code( 0x102f2, 0x00 );
  6434.     patch_code( 0x102f3, 0x02 );
  6435.  
  6436.     sys16_update_proc = sdi_update_proc;
  6437. }
  6438.  
  6439. static void sdi_sprite_decode( void ){
  6440.     sys16_sprite_decode( 3,0x020000 );
  6441. }
  6442.  
  6443. static void init_sdi( void ){
  6444.     sys16_onetime_init_machine();
  6445.     sys18_splittab_bg_x=&sys16_textram[0x0fc0];
  6446.     sys16_rowscroll_scroll=0xff00;
  6447.  
  6448.     sdi_sprite_decode();
  6449. }
  6450.  
  6451. /***************************************************************************/
  6452.  
  6453. INPUT_PORTS_START( sdi )
  6454. PORT_START    /* DSW1 */
  6455.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN  | IPF_8WAY )
  6456.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP    | IPF_8WAY )
  6457.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT | IPF_8WAY )
  6458.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT  | IPF_8WAY )
  6459.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN  | IPF_8WAY | IPF_PLAYER2)
  6460.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP    | IPF_8WAY | IPF_PLAYER2)
  6461.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT | IPF_8WAY | IPF_PLAYER2)
  6462.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT  | IPF_8WAY | IPF_PLAYER2)
  6463.  
  6464.     SYS16_JOY2
  6465.  
  6466. PORT_START /* Service */
  6467.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  6468.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  6469.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  6470.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
  6471.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
  6472.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  6473.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )
  6474.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2)
  6475.  
  6476.     SYS16_COINAGE
  6477.  
  6478. PORT_START    /* DSW1 */
  6479.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
  6480.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  6481.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  6482.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  6483.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  6484.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  6485.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  6486.     PORT_DIPSETTING(    0x08, "2" )
  6487.     PORT_DIPSETTING(    0x0c, "3" )
  6488.     PORT_DIPSETTING(    0x04, "4" )
  6489.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "240?", IP_KEY_NONE, IP_JOY_NONE )
  6490.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
  6491.     PORT_DIPSETTING(    0x20, "Easy" )
  6492.     PORT_DIPSETTING(    0x30, "Normal" )
  6493.     PORT_DIPSETTING(    0x10, "Hard" )
  6494.     PORT_DIPSETTING(    0x00, "Hardest" )
  6495.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) )
  6496.     PORT_DIPSETTING(    0x80, "Every 50000" )
  6497.     PORT_DIPSETTING(    0xc0, "50000" )
  6498.     PORT_DIPSETTING(    0x40, "100000" )
  6499.     PORT_DIPSETTING(    0x00, "None" )
  6500.  
  6501.     PORT_START                /* fake analog X */
  6502.     PORT_ANALOG( 0xff, 0x80, IPT_TRACKBALL_X, 75, 1, 0, 255 )
  6503.  
  6504.     PORT_START                /* fake analog Y */
  6505.     PORT_ANALOG( 0xff, 0x80, IPT_TRACKBALL_Y, 75, 1, 0, 255 )
  6506.  
  6507.     PORT_START                /* fake analog X */
  6508.     PORT_ANALOG( 0xff, 0x80, IPT_TRACKBALL_X | IPF_PLAYER2 , 75, 1, 0, 255 )
  6509.  
  6510.     PORT_START                /* fake analog Y */
  6511.     PORT_ANALOG( 0xff, 0x80, IPT_TRACKBALL_Y | IPF_PLAYER2, 75, 1, 0, 255 )
  6512.  
  6513. INPUT_PORTS_END
  6514.  
  6515. /***************************************************************************/
  6516.  
  6517. MACHINE_DRIVER( machine_driver_sdi, \
  6518.     sdi_readmem,sdi_writemem,sdi_init_machine, gfx1)
  6519.  
  6520. /***************************************************************************/
  6521. // sys18
  6522. ROM_START( shdancer )
  6523.     ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
  6524.     ROM_LOAD_EVEN( "shdancer.a6", 0x000000, 0x40000, 0x3d5b3fa9 )
  6525.     ROM_LOAD_ODD ( "shdancer.a5", 0x000000, 0x40000, 0x2596004e )
  6526.  
  6527.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  6528.     ROM_LOAD( "sd12712.bin", 0x00000, 0x40000, 0x9bdabe3d )
  6529.     ROM_LOAD( "sd12713.bin", 0x40000, 0x40000, 0x852d2b1c )
  6530.     ROM_LOAD( "sd12714.bin", 0x80000, 0x40000, 0x448226ce )
  6531.  
  6532.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  6533.     ROM_LOAD( "sd12719.bin",  0x000000, 0x40000, 0xd6888534 )
  6534.     ROM_LOAD( "sd12726.bin",  0x040000, 0x40000, 0xff344945 )
  6535.     ROM_LOAD( "sd12718.bin",  0x080000, 0x40000, 0xba2efc0c )
  6536.     ROM_LOAD( "sd12725.bin",  0x0c0000, 0x40000, 0x268a0c17 )
  6537.     ROM_LOAD( "sd12717.bin",  0x100000, 0x40000, 0xc81cc4f8 )
  6538.     ROM_LOAD( "sd12724.bin",  0x140000, 0x40000, 0x0f4903dc )
  6539.     ROM_LOAD( "sd12716.bin",  0x180000, 0x40000, 0xa870e629 )
  6540.     ROM_LOAD( "sd12723.bin",  0x1c0000, 0x40000, 0xc606cf90 )
  6541.  
  6542.     ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
  6543.     ROM_LOAD( "sd12720.bin", 0x10000, 0x20000, 0x7a0d8de1 )
  6544.     ROM_LOAD( "sd12715.bin", 0x30000, 0x40000, 0x07051a52 )
  6545. ROM_END
  6546.  
  6547. /***************************************************************************/
  6548.  
  6549. static READ_HANDLER( shdancer_skip_r )
  6550. {
  6551.     if (cpu_get_pc()==0x2f76) {cpu_spinuntil_int(); return 0xffff;}
  6552.  
  6553.     return READ_WORD(&sys16_workingram[0x0000]);
  6554. }
  6555.  
  6556.  
  6557. static struct MemoryReadAddress shdancer_readmem[] =
  6558. {
  6559.     { 0x000000, 0x07ffff, MRA_ROM },
  6560.  
  6561.     { 0x400000, 0x40ffff, MRA_TILERAM },
  6562.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  6563.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  6564.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  6565.     { 0xc00000, 0xc00007, MRA_EXTRAM },
  6566.     { 0xe4000a, 0xe4000b, io_dip1_r },
  6567.     { 0xe4000c, 0xe4000d, io_dip2_r },
  6568.     { 0xe40000, 0xe40001, io_player1_r },
  6569.     { 0xe40002, 0xe40003, io_player2_r },
  6570.     { 0xe40008, 0xe40009, io_service_r },
  6571.     { 0xe40000, 0xe4001f, MRA_EXTRAM2 },
  6572.     { 0xe43034, 0xe43035, MRA_NOP },
  6573.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  6574.     {-1}
  6575. };
  6576.  
  6577. static struct MemoryWriteAddress shdancer_writemem[] =
  6578. {
  6579.     { 0x000000, 0x07ffff, MWA_ROM },
  6580.     { 0x400000, 0x40ffff, MWA_TILERAM },
  6581.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  6582.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  6583.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  6584.     { 0xc00000, 0xc00007, MWA_EXTRAM },
  6585.     { 0xe40000, 0xe4001f, MWA_EXTRAM2 },
  6586.     { 0xe43034, 0xe43035, MWA_NOP },
  6587.     { 0xfe0006, 0xfe0007, sound_command_nmi_w },
  6588.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  6589.     {-1}
  6590. };
  6591. /***************************************************************************/
  6592.  
  6593. static void shdancer_update_proc( void ){
  6594.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  6595.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  6596.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  6597.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  6598.  
  6599.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  6600.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  6601.  
  6602.     sys16_fg2_scrollx = READ_WORD( &sys16_textram[0x0e9c] );
  6603.     sys16_bg2_scrollx = READ_WORD( &sys16_textram[0x0e9e] );
  6604.     sys16_fg2_scrolly = READ_WORD( &sys16_textram[0x0e94] );
  6605.     sys16_bg2_scrolly = READ_WORD( &sys16_textram[0x0e96] );
  6606.  
  6607.     set_fg2_page( READ_WORD( &sys16_textram[0x0e84] ) );
  6608.     set_bg2_page( READ_WORD( &sys16_textram[0x0e86] ) );
  6609.  
  6610.     sys18_bg2_active=0;
  6611.     sys18_fg2_active=0;
  6612.  
  6613.     if(sys16_fg2_scrollx | sys16_fg2_scrolly | READ_WORD( &sys16_textram[0x0e84] ))
  6614.         sys18_fg2_active=1;
  6615.     if(sys16_bg2_scrollx | sys16_bg2_scrolly | READ_WORD( &sys16_textram[0x0e86] ))
  6616.         sys18_bg2_active=1;
  6617.  
  6618.     set_tile_bank18( READ_WORD( &sys16_extraram[0] ) );
  6619.     set_refresh_18( READ_WORD( &sys16_extraram2[0x1c] ) );
  6620. }
  6621.  
  6622. static void shdancer_init_machine( void ){
  6623.     static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
  6624.     sys16_obj_bank = bank;
  6625.     sys16_spritelist_end=0x8000;
  6626.  
  6627.     sys16_update_proc = shdancer_update_proc;
  6628. }
  6629.  
  6630. static void init_shdancer( void ){
  6631.     unsigned char *RAM= memory_region(REGION_CPU2);
  6632.     sys16_onetime_init_machine();
  6633.     sys18_splittab_fg_x=&sys16_textram[0x0f80];
  6634.     sys18_splittab_bg_x=&sys16_textram[0x0fc0];
  6635.     install_mem_read_handler(0, 0xffc000, 0xffc001, shdancer_skip_r );
  6636.     sys16_MaxShadowColors=0;        // doesn't seem to use transparent shadows
  6637.  
  6638.     memcpy(RAM,&RAM[0x10000],0xa000);
  6639.  
  6640.     sys16_sprite_decode( 4,0x080000 );
  6641. }
  6642.  
  6643. /***************************************************************************/
  6644.  
  6645. INPUT_PORTS_START( shdancer )
  6646. PORT_START /* player 1 */
  6647.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
  6648.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  6649.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
  6650.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  6651.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  6652.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  6653.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  6654.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  6655.  
  6656. PORT_START /* player 2 */
  6657.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  6658.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  6659.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  6660.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  6661.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
  6662.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
  6663.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  6664.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
  6665.     SYS16_SERVICE
  6666.     SYS16_COINAGE
  6667.  
  6668. PORT_START    /* DSW1 */
  6669.     PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
  6670.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  6671.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  6672.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  6673.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  6674.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  6675.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  6676.     PORT_DIPSETTING(    0x00, "2" )
  6677.     PORT_DIPSETTING(    0x0c, "3" )
  6678.     PORT_DIPSETTING(    0x08, "4" )
  6679.     PORT_DIPSETTING(    0x04, "5" )
  6680.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
  6681.     PORT_DIPSETTING(    0x20, "Easy" )
  6682.     PORT_DIPSETTING(    0x30, "Normal" )
  6683.     PORT_DIPSETTING(    0x10, "Hard" )
  6684.     PORT_DIPSETTING(    0x00, "Hardest" )
  6685.     PORT_DIPNAME( 0xc0, 0xc0, "Time Adjust" )
  6686.     PORT_DIPSETTING(    0x00, "2.20" )
  6687.     PORT_DIPSETTING(    0x40, "2.40" )
  6688.     PORT_DIPSETTING(    0xc0, "3.00" )
  6689.     PORT_DIPSETTING(    0x80, "3.30" )
  6690.  
  6691. INPUT_PORTS_END
  6692.  
  6693. /***************************************************************************/
  6694.  
  6695. MACHINE_DRIVER_18( machine_driver_shdancer, \
  6696.     shdancer_readmem,shdancer_writemem,shdancer_init_machine, gfx4 )
  6697.  
  6698. /***************************************************************************/
  6699.  
  6700. ROM_START( shdancbl )
  6701.     ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
  6702.     ROM_LOAD_EVEN( "ic39", 0x000000, 0x10000, 0xadc1781c )
  6703.     ROM_LOAD_ODD ( "ic53", 0x000000, 0x10000, 0x1c1ac463 )
  6704.     ROM_LOAD_EVEN( "ic38", 0x020000, 0x10000, 0xcd6e155b )
  6705.     ROM_LOAD_ODD ( "ic52", 0x020000, 0x10000, 0xbb3c49a4 )
  6706.     ROM_LOAD_EVEN( "ic37", 0x040000, 0x10000, 0x1bd8d5c3 )
  6707.     ROM_LOAD_ODD ( "ic51", 0x040000, 0x10000, 0xce2e71b4 )
  6708.     ROM_LOAD_EVEN( "ic36", 0x060000, 0x10000, 0xbb861290 )
  6709.     ROM_LOAD_ODD ( "ic50", 0x060000, 0x10000, 0x7f7b82b1 )
  6710.  
  6711.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  6712.     ROM_LOAD( "ic4",  0x00000, 0x20000, 0xf0a016fe )
  6713.     ROM_LOAD( "ic18", 0x20000, 0x20000, 0xf6bee053 )
  6714.     ROM_LOAD( "ic3",  0x40000, 0x20000, 0xe07e6b5d )
  6715.     ROM_LOAD( "ic17", 0x60000, 0x20000, 0xf59deba1 )
  6716.     ROM_LOAD( "ic2",  0x80000, 0x20000, 0x60095070 )
  6717.     ROM_LOAD( "ic16", 0xa0000, 0x20000, 0x0f0d5dd3 )
  6718.  
  6719.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  6720.     ROM_LOAD( "ic73", 0x000000, 0x10000, 0x59e77c96 )
  6721.     ROM_LOAD( "ic74", 0x010000, 0x10000, 0x90ea5407 )
  6722.     ROM_LOAD( "ic75", 0x020000, 0x10000, 0x27d2fa61 )
  6723.     ROM_LOAD( "ic76", 0x030000, 0x10000, 0xf36db688 )
  6724.     ROM_LOAD( "ic58", 0x040000, 0x10000, 0x9cd5c8c7 )
  6725.     ROM_LOAD( "ic59", 0x050000, 0x10000, 0xff40e872 )
  6726.     ROM_LOAD( "ic60", 0x060000, 0x10000, 0x826d7245 )
  6727.     ROM_LOAD( "ic61", 0x070000, 0x10000, 0xdcf8068b )
  6728.     ROM_LOAD( "ic77", 0x080000, 0x10000, 0xf93470b7 )
  6729.     ROM_LOAD( "ic78", 0x090000, 0x10000, 0x4d523ea3 )
  6730.     ROM_LOAD( "ic95", 0x0a0000, 0x10000, 0x828b8294 )
  6731.     ROM_LOAD( "ic94", 0x0b0000, 0x10000, 0x542b2d1e )
  6732.     ROM_LOAD( "ic62", 0x0c0000, 0x10000, 0x50ca8065 )
  6733.     ROM_LOAD( "ic63", 0x0d0000, 0x10000, 0xd1866aa9 )
  6734.     ROM_LOAD( "ic90", 0x0e0000, 0x10000, 0x3602b758 )
  6735.     ROM_LOAD( "ic89", 0x0f0000, 0x10000, 0x1ba4be93 )
  6736.     ROM_LOAD( "ic79", 0x100000, 0x10000, 0xf22548ee )
  6737.     ROM_LOAD( "ic80", 0x110000, 0x10000, 0x6209f7f9 )
  6738.     ROM_LOAD( "ic81", 0x120000, 0x10000, 0x34692f23 )
  6739.     ROM_LOAD( "ic82", 0x130000, 0x10000, 0x7ae40237 )
  6740.     ROM_LOAD( "ic64", 0x140000, 0x10000, 0x7a8b7bcc )
  6741.     ROM_LOAD( "ic65", 0x150000, 0x10000, 0x90ffca14 )
  6742.     ROM_LOAD( "ic66", 0x160000, 0x10000, 0x5d655517 )
  6743.     ROM_LOAD( "ic67", 0x170000, 0x10000, 0x0e5d0855 )
  6744.     ROM_LOAD( "ic83", 0x180000, 0x10000, 0xa9040a32 )
  6745.     ROM_LOAD( "ic84", 0x190000, 0x10000, 0xd6810031 )
  6746.     ROM_LOAD( "ic92", 0x1a0000, 0x10000, 0xb57d5cb5 )
  6747.     ROM_LOAD( "ic91", 0x1b0000, 0x10000, 0x49def6c8 )
  6748.     ROM_LOAD( "ic68", 0x1c0000, 0x10000, 0x8d684e53 )
  6749.     ROM_LOAD( "ic69", 0x1d0000, 0x10000, 0xc47d32e2 )
  6750.     ROM_LOAD( "ic88", 0x1e0000, 0x10000, 0x9de140e1 )
  6751.     ROM_LOAD( "ic87", 0x1f0000, 0x10000, 0x8172a991 )
  6752.  
  6753.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  6754.     ROM_LOAD( "ic45", 0x10000, 0x10000, 0x576b3a81 )
  6755.     ROM_LOAD( "ic46", 0x20000, 0x10000, 0xc84e8c84 )
  6756. ROM_END
  6757.  
  6758. /***************************************************************************/
  6759.  
  6760. /*
  6761. static READ_HANDLER( shdancer_skip_r )
  6762. {
  6763.     if (cpu_get_pc()==0x2f76) {cpu_spinuntil_int(); return 0xffff;}
  6764.  
  6765.     return READ_WORD(&sys16_workingram[0x0000]);
  6766. }
  6767. */
  6768.  
  6769. static struct MemoryReadAddress shdancbl_readmem[] =
  6770. {
  6771.     { 0x000000, 0x07ffff, MRA_ROM },
  6772.  
  6773.     { 0x400000, 0x40ffff, MRA_TILERAM },
  6774.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  6775.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  6776.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  6777.     { 0xc00000, 0xc00007, MRA_EXTRAM },
  6778.     { 0xc40000, 0xc40001, io_dip1_r },
  6779.     { 0xc40002, 0xc40003, io_dip2_r },
  6780.  
  6781.     { 0xc41002, 0xc41003, io_player1_r },
  6782.     { 0xc41004, 0xc41005, io_player2_r },
  6783.     { 0xc41000, 0xc41001, io_service_r },
  6784. //    { 0xc40000, 0xc4ffff, MRA_EXTRAM3 },
  6785.     { 0xe40000, 0xe4001f, MRA_EXTRAM2 },
  6786.     { 0xe43034, 0xe43035, MRA_NOP },
  6787. //    { 0xffc000, 0xffc001, shdancer_skip_r },
  6788.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  6789.     {-1}
  6790. };
  6791.  
  6792. static struct MemoryWriteAddress shdancbl_writemem[] =
  6793. {
  6794.     { 0x000000, 0x07ffff, MWA_ROM },
  6795.     { 0x400000, 0x40ffff, MWA_TILERAM },
  6796.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  6797.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  6798.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  6799.     { 0xc00000, 0xc00007, MWA_EXTRAM },
  6800. //    { 0xc40000, 0xc4ffff, MWA_EXTRAM3 },
  6801.     { 0xe40000, 0xe4001f, MWA_EXTRAM2 },
  6802.     { 0xe43034, 0xe43035, MWA_NOP },
  6803.     { 0xfe0006, 0xfe0007, sound_command_nmi_w },
  6804.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  6805.     {-1}
  6806. };
  6807. /***************************************************************************/
  6808.  
  6809. static void shdancbl_update_proc( void ){
  6810. // this is all wrong and needs re-doing.
  6811.  
  6812.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  6813.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  6814.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  6815.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  6816.  
  6817.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  6818.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  6819.  
  6820.     sys16_fg2_scrollx = READ_WORD( &sys16_textram[0x0e9c] );
  6821.     sys16_bg2_scrollx = READ_WORD( &sys16_textram[0x0e9e] );
  6822.     sys16_fg2_scrolly = READ_WORD( &sys16_textram[0x0e94] );
  6823.     sys16_bg2_scrolly = READ_WORD( &sys16_textram[0x0e96] );
  6824.  
  6825.     set_fg2_page( READ_WORD( &sys16_textram[0x0e84] ) );
  6826.     set_bg2_page( READ_WORD( &sys16_textram[0x0e82] ) );
  6827.  
  6828.     sys18_bg2_active=0;
  6829.     sys18_fg2_active=0;
  6830.  
  6831.     if(sys16_fg2_scrollx | sys16_fg2_scrolly | READ_WORD( &sys16_textram[0x0e84] ))
  6832.         sys18_fg2_active=1;
  6833.     if(sys16_bg2_scrollx | sys16_bg2_scrolly | READ_WORD( &sys16_textram[0x0e86] ))
  6834.         sys18_bg2_active=1;
  6835.  
  6836.     set_tile_bank18( READ_WORD( &sys16_extraram[0] ) );
  6837.     set_refresh_18( READ_WORD( &sys16_extraram2[0x1c] ) );
  6838. }
  6839.  
  6840.  
  6841. static void shdancbl_init_machine( void ){
  6842.     static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
  6843.     sys16_obj_bank = bank;
  6844.     sys16_spritelist_end=0x8000;
  6845.     sys16_sprxoffset = -0xbc+0x77;
  6846.  
  6847.     sys16_update_proc = shdancbl_update_proc;
  6848. }
  6849.  
  6850. static void init_shdancbl( void ){
  6851.     unsigned char *RAM= memory_region(REGION_CPU2);
  6852.     int i;
  6853.  
  6854.     sys16_onetime_init_machine();
  6855.     sys18_splittab_fg_x=&sys16_textram[0x0f80];
  6856.     sys18_splittab_bg_x=&sys16_textram[0x0fc0];
  6857.     install_mem_read_handler(0, 0xffc000, 0xffc001, shdancer_skip_r );
  6858.     sys16_MaxShadowColors=0;        // doesn't seem to use transparent shadows
  6859.  
  6860.     memcpy(RAM,&RAM[0x10000],0xa000);
  6861.  
  6862.     /* invert the graphics bits on the tiles */
  6863.     for (i = 0; i < 0xc0000; i++)
  6864.         memory_region(REGION_GFX1)[i] ^= 0xff;
  6865.     sys16_sprite_decode( 4,0x080000 );
  6866. }
  6867. /***************************************************************************/
  6868.  
  6869. MACHINE_DRIVER_18( machine_driver_shdancbl, \
  6870.     shdancbl_readmem,shdancbl_writemem,shdancbl_init_machine, gfx4 )
  6871.  
  6872. /***************************************************************************/
  6873. // sys18
  6874. ROM_START( shdancrj )
  6875.     ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
  6876.     ROM_LOAD_EVEN( "sd12722b.bin", 0x000000, 0x40000, 0xc00552a2 )
  6877.     ROM_LOAD_ODD ( "sd12721b.bin", 0x000000, 0x40000, 0x653d351a )
  6878.  
  6879.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  6880.     ROM_LOAD( "sd12712.bin",  0x00000, 0x40000, 0x9bdabe3d )
  6881.     ROM_LOAD( "sd12713.bin",  0x40000, 0x40000, 0x852d2b1c )
  6882.     ROM_LOAD( "sd12714.bin",  0x80000, 0x40000, 0x448226ce )
  6883.  
  6884.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  6885.     ROM_LOAD( "sd12719.bin",  0x000000, 0x40000, 0xd6888534 )
  6886.     ROM_LOAD( "sd12726.bin",  0x040000, 0x40000, 0xff344945 )
  6887.     ROM_LOAD( "sd12718.bin",  0x080000, 0x40000, 0xba2efc0c )
  6888.     ROM_LOAD( "sd12725.bin",  0x0c0000, 0x40000, 0x268a0c17 )
  6889.     ROM_LOAD( "sd12717.bin",  0x100000, 0x40000, 0xc81cc4f8 )
  6890.     ROM_LOAD( "sd12724.bin",  0x140000, 0x40000, 0x0f4903dc )
  6891.     ROM_LOAD( "sd12716.bin",  0x180000, 0x40000, 0xa870e629 )
  6892.     ROM_LOAD( "sd12723.bin",  0x1c0000, 0x40000, 0xc606cf90 )
  6893.  
  6894.     ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
  6895.     ROM_LOAD( "sd12720.bin", 0x10000, 0x20000, 0x7a0d8de1 )
  6896.     ROM_LOAD( "sd12715.bin", 0x30000, 0x40000, 0x07051a52 )
  6897. ROM_END
  6898.  
  6899. /***************************************************************************/
  6900. static READ_HANDLER( shdancrj_skip_r )
  6901. {
  6902.     if (cpu_get_pc()==0x2f70) {cpu_spinuntil_int(); return 0xffff;}
  6903.  
  6904.     return READ_WORD(&sys16_workingram[0xc000]);
  6905. }
  6906.  
  6907. static void shdancrj_init_machine( void ){
  6908.     static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
  6909.     sys16_obj_bank = bank;
  6910.     sys16_spritelist_end=0x8000;
  6911.  
  6912.     patch_code(0x6821, 0xdf);
  6913.     sys16_update_proc = shdancer_update_proc;
  6914. }
  6915.  
  6916. static void init_shdancrj( void ){
  6917.     unsigned char *RAM= memory_region(REGION_CPU2);
  6918.     sys16_onetime_init_machine();
  6919.     sys18_splittab_fg_x=&sys16_textram[0x0f80];
  6920.     sys18_splittab_bg_x=&sys16_textram[0x0fc0];
  6921.     install_mem_read_handler(0, 0xffc000, 0xffc001, shdancrj_skip_r );
  6922.  
  6923.     memcpy(RAM,&RAM[0x10000],0xa000);
  6924.  
  6925.     sys16_sprite_decode( 4,0x080000 );
  6926. }
  6927.  
  6928. /***************************************************************************/
  6929.  
  6930. MACHINE_DRIVER_18( machine_driver_shdancrj, \
  6931.     shdancer_readmem,shdancer_writemem,shdancrj_init_machine, gfx4 )
  6932.  
  6933. /***************************************************************************/
  6934. // sys16B
  6935. ROM_START( shinobi )
  6936.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  6937.     ROM_LOAD_EVEN( "shinobi.a4", 0x000000, 0x10000, 0xb930399d )
  6938.     ROM_LOAD_ODD ( "shinobi.a1", 0x000000, 0x10000, 0x343f4c46 )
  6939.     ROM_LOAD_EVEN( "epr11283",   0x020000, 0x10000, 0x9d46e707 )
  6940.     ROM_LOAD_ODD ( "epr11281",   0x020000, 0x10000, 0x7961d07e )
  6941.  
  6942.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  6943.     ROM_LOAD( "shinobi.b9",  0x00000, 0x10000, 0x5f62e163 )
  6944.     ROM_LOAD( "shinobi.b10", 0x10000, 0x10000, 0x75f8fbc9 )
  6945.     ROM_LOAD( "shinobi.b11", 0x20000, 0x10000, 0x06508bb9 )
  6946.  
  6947.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  6948.     ROM_LOAD( "epr11290.10", 0x00000, 0x10000, 0x611f413a )
  6949.     ROM_LOAD( "epr11294.11", 0x10000, 0x10000, 0x5eb00fc1 )
  6950.     ROM_LOAD( "epr11291.17", 0x20000, 0x10000, 0x3c0797c0 )
  6951.     ROM_LOAD( "epr11295.18", 0x30000, 0x10000, 0x25307ef8 )
  6952.     ROM_LOAD( "epr11292.23", 0x40000, 0x10000, 0xc29ac34e )
  6953.     ROM_LOAD( "epr11296.24", 0x50000, 0x10000, 0x04a437f8 )
  6954.     ROM_LOAD( "epr11293.29", 0x60000, 0x10000, 0x41f41063 )
  6955.     ROM_LOAD( "epr11297.30", 0x70000, 0x10000, 0xb6e1fd72 )
  6956.  
  6957.     ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
  6958.     ROM_LOAD( "shinobi.a7", 0x0000, 0x8000, 0x2457a7cf )
  6959.     ROM_LOAD( "shinobi.a8", 0x10000, 0x8000, 0xc8df8460 )
  6960.     ROM_LOAD( "shinobi.a9", 0x18000, 0x8000, 0xe5a4cf30 )
  6961.  
  6962. ROM_END
  6963.  
  6964. ROM_START( shinobib )
  6965.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  6966. // Custom cpu 317-0049
  6967.     ROM_LOAD_EVEN( "epr11282", 0x000000, 0x10000, 0x5f2e5524 )
  6968.     ROM_LOAD_ODD ( "epr11280", 0x000000, 0x10000, 0xbdfe5c38 )
  6969.     ROM_LOAD_EVEN( "epr11283", 0x020000, 0x10000, 0x9d46e707 )
  6970.     ROM_LOAD_ODD ( "epr11281", 0x020000, 0x10000, 0x7961d07e )
  6971.  
  6972.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  6973.     ROM_LOAD( "shinobi.b9",  0x00000, 0x10000, 0x5f62e163 )
  6974.     ROM_LOAD( "shinobi.b10", 0x10000, 0x10000, 0x75f8fbc9 )
  6975.     ROM_LOAD( "shinobi.b11", 0x20000, 0x10000, 0x06508bb9 )
  6976.  
  6977.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  6978.     ROM_LOAD( "epr11290.10", 0x00000, 0x10000, 0x611f413a )
  6979.     ROM_LOAD( "epr11294.11", 0x10000, 0x10000, 0x5eb00fc1 )
  6980.     ROM_LOAD( "epr11291.17", 0x20000, 0x10000, 0x3c0797c0 )
  6981.     ROM_LOAD( "epr11295.18", 0x30000, 0x10000, 0x25307ef8 )
  6982.     ROM_LOAD( "epr11292.23", 0x40000, 0x10000, 0xc29ac34e )
  6983.     ROM_LOAD( "epr11296.24", 0x50000, 0x10000, 0x04a437f8 )
  6984.     ROM_LOAD( "epr11293.29", 0x60000, 0x10000, 0x41f41063 )
  6985.     ROM_LOAD( "epr11297.30", 0x70000, 0x10000, 0xb6e1fd72 )
  6986.  
  6987.     ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
  6988.     ROM_LOAD( "shinobi.a7", 0x0000, 0x8000, 0x2457a7cf )
  6989.     ROM_LOAD( "shinobi.a8", 0x10000, 0x8000, 0xc8df8460 )
  6990.     ROM_LOAD( "shinobi.a9", 0x18000, 0x8000, 0xe5a4cf30 )
  6991.  
  6992. ROM_END
  6993.  
  6994. /***************************************************************************/
  6995.  
  6996. static READ_HANDLER( shinobi_skip_r )
  6997. {
  6998.     if (cpu_get_pc()==0x32e0) {cpu_spinuntil_int(); return 1<<8;}
  6999.  
  7000.     return READ_WORD(&sys16_workingram[0x301c]);
  7001. }
  7002.  
  7003. static struct MemoryReadAddress shinobi_readmem[] =
  7004. {
  7005.     { 0x000000, 0x03ffff, MRA_ROM },
  7006.     { 0x400000, 0x40ffff, MRA_TILERAM },
  7007.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  7008.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  7009.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  7010.     { 0xc41002, 0xc41003, io_player1_r },
  7011.     { 0xc41006, 0xc41007, io_player2_r },
  7012.     { 0xc41000, 0xc41001, io_service_r },
  7013.     { 0xc42002, 0xc42003, io_dip1_r },
  7014.     { 0xc42000, 0xc42001, io_dip2_r },
  7015.     { 0xc40000, 0xc40001, MRA_EXTRAM2 },
  7016.     { 0xc43000, 0xc43001, MRA_NOP },
  7017.     { 0xfff01c, 0xfff01d, shinobi_skip_r },
  7018.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  7019.     {-1}
  7020. };
  7021.  
  7022. static struct MemoryWriteAddress shinobi_writemem[] =
  7023. {
  7024.     { 0x000000, 0x03ffff, MWA_ROM },
  7025.     { 0x400000, 0x40ffff, MWA_TILERAM },
  7026.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  7027.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  7028.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  7029.     { 0xc40000, 0xc40001, MWA_EXTRAM2 },
  7030.     { 0xc43000, 0xc43001, MWA_NOP },
  7031.     { 0xfe0006, 0xfe0007, sound_command_w },
  7032.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  7033.     {-1}
  7034. };
  7035.  
  7036. /***************************************************************************/
  7037.  
  7038. static void shinobi_update_proc( void ){
  7039.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  7040.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  7041.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  7042.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  7043.  
  7044.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  7045.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  7046.  
  7047.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  7048. }
  7049.  
  7050. static void shinobi_init_machine( void ){
  7051.     static int bank[16] = { 0,0,0,0,0,0,0,6,0,0,0,4,0,2,0,0 };
  7052.     sys16_obj_bank = bank;
  7053.     sys16_dactype = 1;
  7054.     sys16_update_proc = shinobi_update_proc;
  7055. }
  7056.  
  7057. static void init_shinobi( void )
  7058. {
  7059.     sys16_onetime_init_machine();
  7060.     sys16_sprite_decode( 4,0x20000 );
  7061. }
  7062.  
  7063. /***************************************************************************/
  7064.  
  7065. INPUT_PORTS_START( shinobi )
  7066.     SYS16_JOY1
  7067.     SYS16_JOY2
  7068.     SYS16_SERVICE
  7069.     SYS16_COINAGE
  7070.  
  7071. PORT_START
  7072.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  7073.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  7074.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  7075.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  7076.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  7077.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7078.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  7079.     PORT_DIPSETTING(    0x08, "2" )
  7080.     PORT_DIPSETTING(    0x0c, "3" )
  7081.     PORT_DIPSETTING(    0x04, "5" )
  7082.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "240", IP_KEY_NONE, IP_JOY_NONE )
  7083.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
  7084.     PORT_DIPSETTING(    0x20, "Easy" )
  7085.     PORT_DIPSETTING(    0x30, "Normal" )
  7086.     PORT_DIPSETTING(    0x10, "Hard" )
  7087.     PORT_DIPSETTING(    0x00, "Hardest" )
  7088.     PORT_DIPNAME( 0x40, 0x40, "Enemy's Bullet Speed" )
  7089.     PORT_DIPSETTING(    0x40, "Slow" )
  7090.     PORT_DIPSETTING(    0x00, "Fast" )
  7091.     PORT_DIPNAME( 0x80, 0x80, "Language" )
  7092.     PORT_DIPSETTING(    0x80, "Japanese" )
  7093.     PORT_DIPSETTING(    0x00, "English" )
  7094.  
  7095. INPUT_PORTS_END
  7096.  
  7097. /***************************************************************************/
  7098.  
  7099. MACHINE_DRIVER_7759( machine_driver_shinobi, \
  7100.     shinobi_readmem,shinobi_writemem,shinobi_init_machine, gfx1,upd7759_interface )
  7101.  
  7102. /***************************************************************************/
  7103. // sys16A
  7104. ROM_START( shinobia )
  7105.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  7106. // custom cpu 317-0050
  7107.     ROM_LOAD_EVEN( "epr11262.42", 0x000000, 0x10000, 0xd4b8df12 )
  7108.     ROM_LOAD_ODD ( "epr11260.27", 0x000000, 0x10000, 0x2835c95d )
  7109.     ROM_LOAD_EVEN( "epr11263.43", 0x020000, 0x10000, 0xa2a620bd )
  7110.     ROM_LOAD_ODD ( "epr11261.25", 0x020000, 0x10000, 0xa3ceda52 )
  7111.  
  7112.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  7113.     ROM_LOAD( "epr11264.95", 0x00000, 0x10000, 0x46627e7d )
  7114.     ROM_LOAD( "epr11265.94", 0x10000, 0x10000, 0x87d0f321 )
  7115.     ROM_LOAD( "epr11266.93", 0x20000, 0x10000, 0xefb4af87 )
  7116.  
  7117.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  7118.     ROM_LOAD( "epr11290.10", 0x00000, 0x10000, 0x611f413a )
  7119.     ROM_LOAD( "epr11294.11", 0x10000, 0x10000, 0x5eb00fc1 )
  7120.     ROM_LOAD( "epr11291.17", 0x20000, 0x10000, 0x3c0797c0 )
  7121.     ROM_LOAD( "epr11295.18", 0x30000, 0x10000, 0x25307ef8 )
  7122.     ROM_LOAD( "epr11292.23", 0x40000, 0x10000, 0xc29ac34e )
  7123.     ROM_LOAD( "epr11296.24", 0x50000, 0x10000, 0x04a437f8 )
  7124.     ROM_LOAD( "epr11293.29", 0x60000, 0x10000, 0x41f41063 )
  7125.     ROM_LOAD( "epr11297.30", 0x70000, 0x10000, 0xb6e1fd72 )
  7126.  
  7127.     ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
  7128.     ROM_LOAD( "epr11267.12", 0x0000, 0x8000, 0xdd50b745 )
  7129.  
  7130.     ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
  7131.     ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
  7132.  
  7133.     ROM_REGION( 0x08000, REGION_SOUND1 ) /* 7751 sound data */
  7134.     ROM_LOAD( "epr11268.1", 0x0000, 0x8000, 0x6d7966da )
  7135. ROM_END
  7136.  
  7137.  
  7138. ROM_START( shinobl )
  7139.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  7140. // Star Bootleg
  7141.     ROM_LOAD_EVEN( "b3",          0x000000, 0x10000, 0x38e59646 )
  7142.     ROM_LOAD_ODD ( "b1",          0x000000, 0x10000, 0x8529d192 )
  7143.     ROM_LOAD_EVEN( "epr11263.43", 0x020000, 0x10000, 0xa2a620bd )
  7144.     ROM_LOAD_ODD ( "epr11261.25", 0x020000, 0x10000, 0xa3ceda52 )
  7145.  
  7146. // Beta Bootleg
  7147. //    ROM_LOAD_EVEN( "4",           0x000000, 0x10000, 0xc178a39c )
  7148. //    ROM_LOAD_ODD ( "2",           0x000000, 0x10000, 0x5ad8ebf2 )
  7149. //    ROM_LOAD_EVEN( "epr11263.43", 0x020000, 0x10000, 0xa2a620bd )
  7150. //    ROM_LOAD_ODD ( "epr11261.25", 0x020000, 0x10000, 0xa3ceda52 )
  7151.  
  7152.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  7153.     ROM_LOAD( "epr11264.95", 0x00000, 0x10000, 0x46627e7d )
  7154.     ROM_LOAD( "epr11265.94", 0x10000, 0x10000, 0x87d0f321 )
  7155.     ROM_LOAD( "epr11266.93", 0x20000, 0x10000, 0xefb4af87 )
  7156.  
  7157.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  7158.     ROM_LOAD( "epr11290.10", 0x00000, 0x10000, 0x611f413a )
  7159.     ROM_LOAD( "epr11294.11", 0x10000, 0x10000, 0x5eb00fc1 )
  7160.     ROM_LOAD( "epr11291.17", 0x20000, 0x10000, 0x3c0797c0 )
  7161.     ROM_LOAD( "epr11295.18", 0x30000, 0x10000, 0x25307ef8 )
  7162.     ROM_LOAD( "epr11292.23", 0x40000, 0x10000, 0xc29ac34e )
  7163.     ROM_LOAD( "epr11296.24", 0x50000, 0x10000, 0x04a437f8 )
  7164.     ROM_LOAD( "epr11293.29", 0x60000, 0x10000, 0x41f41063 )
  7165. //    ROM_LOAD( "epr11297.30", 0x70000, 0x10000, 0xb6e1fd72 )
  7166.     ROM_LOAD( "b17",         0x70000, 0x10000, 0x0315cf42 )    // Beta bootleg uses the rom above.
  7167.  
  7168.     ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
  7169.     ROM_LOAD( "epr11267.12", 0x0000, 0x8000, 0xdd50b745 )
  7170.  
  7171.     ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
  7172.     ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
  7173.  
  7174.     ROM_REGION( 0x08000, REGION_SOUND1 ) /* 7751 sound data */
  7175.     ROM_LOAD( "epr11268.1", 0x0000, 0x8000, 0x6d7966da )
  7176. ROM_END
  7177.  
  7178. /***************************************************************************/
  7179.  
  7180. static struct MemoryReadAddress shinobl_readmem[] =
  7181. {
  7182.     { 0x000000, 0x03ffff, MRA_ROM },
  7183.     { 0x400000, 0x40ffff, MRA_TILERAM },
  7184.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  7185.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  7186.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  7187.     { 0xc41002, 0xc41003, io_player1_r },
  7188.     { 0xc41006, 0xc41007, io_player2_r },
  7189.     { 0xc41000, 0xc41001, io_service_r },
  7190.     { 0xc42000, 0xc42001, io_dip1_r },
  7191.     { 0xc42002, 0xc42003, io_dip2_r },
  7192.     { 0xc40000, 0xc40fff, MRA_EXTRAM2 },
  7193.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  7194.     {-1}
  7195. };
  7196.  
  7197. static struct MemoryWriteAddress shinobl_writemem[] =
  7198. {
  7199.     { 0x000000, 0x03ffff, MWA_ROM },
  7200.     { 0x400000, 0x40ffff, MWA_TILERAM },
  7201.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  7202.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  7203.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  7204.     { 0xc40000, 0xc40001, sound_command_nmi_w },
  7205.     { 0xc40000, 0xc40fff, MWA_EXTRAM2 },
  7206.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  7207.     {-1}
  7208. };
  7209.  
  7210. /***************************************************************************/
  7211.  
  7212. static void shinobl_update_proc( void ){
  7213.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
  7214.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
  7215.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
  7216.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
  7217.  
  7218.     set_fg_page( READ_WORD( &sys16_textram[0x0e9e] ) );
  7219.     set_bg_page( READ_WORD( &sys16_textram[0x0e9c] ) );
  7220.  
  7221.     set_refresh_3d( READ_WORD( &sys16_extraram2[2] ) );
  7222.  
  7223. }
  7224.  
  7225. static void shinobl_init_machine( void ){
  7226.     static int bank[16] = {0,2,4,6,1,3,5,7,0,0,0,0,0,0,0,0};
  7227.     sys16_obj_bank = bank;
  7228.     sys16_textmode=1;
  7229.     sys16_spritesystem = 2;
  7230.     sys16_sprxoffset = -0xbc;
  7231.     sys16_fgxoffset = sys16_bgxoffset = 7;
  7232.     sys16_tilebank_switch=0x2000;
  7233.  
  7234.     sys16_dactype = 1;
  7235.     sys16_update_proc = shinobl_update_proc;
  7236. }
  7237.  
  7238.  
  7239.  
  7240. /***************************************************************************/
  7241.  
  7242. MACHINE_DRIVER_7751( machine_driver_shinobl, \
  7243.     shinobl_readmem,shinobl_writemem,shinobl_init_machine, gfx1)
  7244.  
  7245. /***************************************************************************/
  7246.  
  7247. // sys16A custom
  7248. ROM_START( tetris )
  7249.     ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
  7250.     ROM_LOAD_EVEN( "epr12201.rom", 0x000000, 0x8000, 0x338e9b51 )
  7251.     ROM_LOAD_ODD ( "epr12200.rom", 0x000000, 0x8000, 0xfb058779 )
  7252.  
  7253.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  7254.     ROM_LOAD( "epr12202.rom", 0x00000, 0x10000, 0x2f7da741 )
  7255.     ROM_LOAD( "epr12203.rom", 0x10000, 0x10000, 0xa6e58ec5 )
  7256.     ROM_LOAD( "epr12204.rom", 0x20000, 0x10000, 0x0ae98e23 )
  7257.  
  7258.     ROM_REGION( 0x010000*2, REGION_GFX2 ) /* sprites */
  7259.     ROM_LOAD( "epr12169.rom", 0x0000, 0x8000, 0xdacc6165 )
  7260.     ROM_LOAD( "epr12170.rom", 0x8000, 0x8000, 0x87354e42 )
  7261.  
  7262.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  7263.     ROM_LOAD( "epr12205.rom", 0x0000, 0x8000, 0x6695dc99 )
  7264. ROM_END
  7265.  
  7266. // sys16B
  7267. ROM_START( tetrisbl )
  7268.     ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
  7269.     ROM_LOAD_EVEN( "rom2.bin", 0x000000, 0x10000, 0x4d165c38 )
  7270.     ROM_LOAD_ODD ( "rom1.bin", 0x000000, 0x10000, 0x1e912131 )
  7271.  
  7272.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  7273.     ROM_LOAD( "scr01.rom", 0x00000, 0x10000, 0x62640221 )
  7274.     ROM_LOAD( "scr02.rom", 0x10000, 0x10000, 0x9abd183b )
  7275.     ROM_LOAD( "scr03.rom", 0x20000, 0x10000, 0x2495fd4e )
  7276.  
  7277.     ROM_REGION( 0x020000*2, REGION_GFX2 ) /* sprites */
  7278.     ROM_LOAD( "obj0-o.rom", 0x00000, 0x10000, 0x2fb38880 )
  7279.     ROM_LOAD( "obj0-e.rom", 0x10000, 0x10000, 0xd6a02cba )
  7280.  
  7281.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  7282.     ROM_LOAD( "s-prog.rom", 0x0000, 0x8000, 0xbd9ba01b )
  7283. ROM_END
  7284.  
  7285. // sys16B
  7286. ROM_START( tetrisa )
  7287.     ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
  7288. // Custom Cpu 317-0092
  7289.     ROM_LOAD_EVEN( "tetris.a7", 0x000000, 0x10000, 0x9ce15ac9 )
  7290.     ROM_LOAD_ODD ( "tetris.a5", 0x000000, 0x10000, 0x98d590ca )
  7291.  
  7292.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  7293.     ROM_LOAD( "scr01.rom", 0x00000, 0x10000, 0x62640221 )
  7294.     ROM_LOAD( "scr02.rom", 0x10000, 0x10000, 0x9abd183b )
  7295.     ROM_LOAD( "scr03.rom", 0x20000, 0x10000, 0x2495fd4e )
  7296.  
  7297.     ROM_REGION( 0x020000*2, REGION_GFX2 ) /* sprites */
  7298.     ROM_LOAD( "obj0-o.rom", 0x00000, 0x10000, 0x2fb38880 )
  7299.     ROM_LOAD( "obj0-e.rom", 0x10000, 0x10000, 0xd6a02cba )
  7300.  
  7301.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  7302.     ROM_LOAD( "s-prog.rom", 0x0000, 0x8000, 0xbd9ba01b )
  7303. ROM_END
  7304.  
  7305. /***************************************************************************/
  7306.  
  7307. static struct MemoryReadAddress tetris_readmem[] =
  7308. {
  7309.     { 0x000000, 0x01ffff, MRA_ROM },
  7310.     { 0x400000, 0x40ffff, MRA_TILERAM },
  7311.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  7312.     { 0x418000, 0x41803f, MRA_EXTRAM2 },
  7313.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  7314.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  7315.     { 0xc40000, 0xc40001, MRA_EXTRAM },
  7316.     { 0xc41002, 0xc41003, io_player1_r },
  7317.     { 0xc41006, 0xc41007, io_player2_r },
  7318.     { 0xc41000, 0xc41001, io_service_r },
  7319.     { 0xc42002, 0xc42003, io_dip1_r },
  7320.     { 0xc42000, 0xc42001, io_dip2_r },
  7321.     { 0xc80000, 0xc80001, MRA_NOP },
  7322.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  7323.     {-1}
  7324. };
  7325.  
  7326. static struct MemoryWriteAddress tetris_writemem[] =
  7327. {
  7328.     { 0x000000, 0x01ffff, MWA_ROM },
  7329.     { 0x400000, 0x40ffff, MWA_TILERAM },
  7330.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  7331.     { 0x418000, 0x41803f, MWA_EXTRAM2 },
  7332.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  7333.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  7334.     { 0xc40000, 0xc40001, MWA_EXTRAM },
  7335.     { 0xc42006, 0xc42007, sound_command_w },
  7336.     { 0xc43034, 0xc43035, MWA_NOP },
  7337.     { 0xc80000, 0xc80001, MWA_NOP },
  7338.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  7339.     {-1}
  7340. };
  7341. /***************************************************************************/
  7342.  
  7343. static void tetris_update_proc( void ){
  7344.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  7345.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  7346.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  7347.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  7348.  
  7349.     set_fg_page( READ_WORD( &sys16_extraram2[0x38] ) );
  7350.     set_bg_page( READ_WORD( &sys16_extraram2[0x28] ) );
  7351.  
  7352.     set_refresh( READ_WORD( &sys16_extraram[0x0] ) );
  7353. }
  7354.  
  7355. static void tetris_init_machine( void ){
  7356.     static int bank[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  7357.  
  7358.     sys16_obj_bank = bank;
  7359.  
  7360.     patch_code( 0xba6, 0x4e );
  7361.     patch_code( 0xba7, 0x71 );
  7362.  
  7363.     sys16_sprxoffset = -0x40;
  7364.     sys16_update_proc = tetris_update_proc;
  7365. }
  7366.  
  7367. static void init_tetris( void )
  7368. {
  7369.     sys16_onetime_init_machine();
  7370.     sys16_sprite_decode( 1,0x10000 );
  7371. }
  7372.  
  7373. static void init_tetrisbl( void )
  7374. {
  7375.     sys16_onetime_init_machine();
  7376.     sys16_sprite_decode( 1,0x20000 );
  7377. }
  7378. /***************************************************************************/
  7379.  
  7380. INPUT_PORTS_START( tetris )
  7381.     SYS16_JOY1
  7382.     SYS16_JOY2
  7383.     SYS16_SERVICE
  7384.     SYS16_COINAGE /* unconfirmed */
  7385.  
  7386. PORT_START    /* DSW1 */
  7387.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  7388.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  7389.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7390.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  7391.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  7392.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7393.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) )    // from the code it looks like some kind of difficulty
  7394.     PORT_DIPSETTING(    0x0c, "A" )                    // level, but all 4 levels points to the same place
  7395.     PORT_DIPSETTING(    0x08, "B" )                    // so it doesn't actually change anything!!
  7396.     PORT_DIPSETTING(    0x04, "C" )
  7397.     PORT_DIPSETTING(    0x00, "D" )
  7398.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
  7399.     PORT_DIPSETTING(    0x20, "Easy" )
  7400.     PORT_DIPSETTING(    0x30, "Normal" )
  7401.     PORT_DIPSETTING(    0x10, "Hard" )
  7402.     PORT_DIPSETTING(    0x00, "Hardest" )
  7403.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  7404.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  7405.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7406.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  7407.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  7408.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7409. INPUT_PORTS_END
  7410.  
  7411. /***************************************************************************/
  7412.  
  7413. MACHINE_DRIVER( machine_driver_tetris, \
  7414.     tetris_readmem,tetris_writemem,tetris_init_machine, gfx1 )
  7415.  
  7416. /***************************************************************************/
  7417. // sys16B
  7418. ROM_START( timscanr )
  7419.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  7420.     ROM_LOAD_EVEN( "ts10853.bin", 0x00000, 0x8000, 0x24d7c5fb )
  7421.     ROM_LOAD_ODD ( "ts10850.bin", 0x00000, 0x8000, 0xf1575732 )
  7422.     ROM_LOAD_EVEN( "ts10854.bin", 0x10000, 0x8000, 0x82d0b237 )
  7423.     ROM_LOAD_ODD ( "ts10851.bin", 0x10000, 0x8000, 0xf5ce271b )
  7424.     ROM_LOAD_EVEN( "ts10855.bin", 0x20000, 0x8000, 0x63e95a53 )
  7425.     ROM_LOAD_ODD ( "ts10852.bin", 0x20000, 0x8000, 0x7cd1382b )
  7426.  
  7427.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  7428.     ROM_LOAD( "timscanr.b9",  0x00000, 0x8000, 0x07dccc37 )
  7429.     ROM_LOAD( "timscanr.b10", 0x08000, 0x8000, 0x84fb9a3a )
  7430.     ROM_LOAD( "timscanr.b11", 0x10000, 0x8000, 0xc8694bc0 )
  7431.  
  7432.     ROM_REGION( 0x40000*2, REGION_GFX2 ) /* sprites */
  7433.     ROM_LOAD( "ts10548.bin", 0x00000, 0x8000, 0xaa150735 )
  7434.     ROM_LOAD( "ts10552.bin", 0x08000, 0x8000, 0x6fcbb9f7 )
  7435.     ROM_LOAD( "ts10549.bin", 0x10000, 0x8000, 0x2f59f067 )
  7436.     ROM_LOAD( "ts10553.bin", 0x18000, 0x8000, 0x8a220a9f )
  7437.     ROM_LOAD( "ts10550.bin", 0x20000, 0x8000, 0xf05069ff )
  7438.     ROM_LOAD( "ts10554.bin", 0x28000, 0x8000, 0xdc64f809 )
  7439.     ROM_LOAD( "ts10551.bin", 0x30000, 0x8000, 0x435d811f )
  7440.     ROM_LOAD( "ts10555.bin", 0x38000, 0x8000, 0x2143c471 )
  7441.  
  7442.     ROM_REGION( 0x18000, REGION_CPU2 ) /* sound CPU */
  7443.     ROM_LOAD( "ts10562.bin", 0x0000, 0x8000, 0x3f5028bf )
  7444.     ROM_LOAD( "ts10563.bin", 0x10000, 0x8000, 0x9db7eddf )
  7445. ROM_END
  7446.  
  7447. /***************************************************************************/
  7448.  
  7449. static READ_HANDLER( timscanr_skip_r )
  7450. {
  7451.     if (cpu_get_pc()==0x1044c) {cpu_spinuntil_int(); return 0;}
  7452.  
  7453.     return READ_WORD(&sys16_workingram[0x000c]);
  7454. }
  7455.  
  7456.  
  7457. static struct MemoryReadAddress timscanr_readmem[] =
  7458. {
  7459.     { 0x000000, 0x02ffff, MRA_ROM },
  7460.     { 0x400000, 0x40ffff, MRA_TILERAM },
  7461.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  7462.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  7463.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  7464.     { 0xc41002, 0xc41003, io_player1_r },
  7465.     { 0xc41006, 0xc41007, io_player2_r },
  7466.     { 0xc41000, 0xc41001, io_service_r },
  7467.     { 0xc42002, 0xc42003, io_dip1_r },
  7468.     { 0xc42000, 0xc42001, io_dip2_r },
  7469.     { 0xc41004, 0xc41005, io_dip3_r },
  7470.     { 0xffc00c, 0xffc00d, timscanr_skip_r },
  7471.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  7472.     {-1}
  7473. };
  7474.  
  7475. static struct MemoryWriteAddress timscanr_writemem[] =
  7476. {
  7477.     { 0x000000, 0x02ffff, MWA_ROM },
  7478.     { 0x400000, 0x40ffff, MWA_TILERAM },
  7479.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  7480.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  7481.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  7482.     { 0xc40000, 0xc40001, MWA_EXTRAM },
  7483.     { 0xfe0006, 0xfe0007, sound_command_w },
  7484.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  7485.     {-1}
  7486. };
  7487. /***************************************************************************/
  7488.  
  7489. static void timscanr_update_proc( void ){
  7490.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  7491.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  7492.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  7493.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  7494.  
  7495.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  7496.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  7497.  
  7498.     set_refresh( READ_WORD( &sys16_extraram[0x0] ) );
  7499. }
  7500.  
  7501. static void timscanr_init_machine( void ){
  7502.     static int bank[16] = {00,00,00,00,00,00,00,0x03,00,00,00,0x02,00,0x01,00,00};
  7503.     sys16_obj_bank = bank;
  7504.     sys16_textmode=1;
  7505.     sys16_update_proc = timscanr_update_proc;
  7506. }
  7507.  
  7508. static void init_timscanr( void )
  7509. {
  7510.     sys16_onetime_init_machine();
  7511.     sys16_sprite_decode( 4,0x10000 );
  7512. }
  7513. /***************************************************************************/
  7514.  
  7515. INPUT_PORTS_START( timscanr )
  7516.     SYS16_JOY1
  7517.     SYS16_JOY2
  7518.     SYS16_SERVICE
  7519.     SYS16_COINAGE
  7520.  
  7521. PORT_START    /* DSW2 */
  7522.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )        //??
  7523.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  7524.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  7525.     PORT_DIPNAME( 0x1e, 0x14, "Bonus" )
  7526.     PORT_DIPSETTING(    0x16, "Replay 1000000/2000000" )
  7527.     PORT_DIPSETTING(    0x14, "Replay 1200000/2500000" )
  7528.     PORT_DIPSETTING(    0x12, "Replay 1500000/3000000" )
  7529.     PORT_DIPSETTING(    0x10, "Replay 2000000/4000000" )
  7530.     PORT_DIPSETTING(    0x1c, "Replay 1000000" )
  7531.     PORT_DIPSETTING(    0x1e, "Replay 1200000" )
  7532.     PORT_DIPSETTING(    0x1a, "Replay 1500000" )
  7533.     PORT_DIPSETTING(    0x18, "Replay 1800000" )
  7534.     PORT_DIPSETTING(    0x0e, "ExtraBall 100000" )
  7535.     PORT_DIPSETTING(    0x0c, "ExtraBall 200000" )
  7536.     PORT_DIPSETTING(    0x0a, "ExtraBall 300000" )
  7537.     PORT_DIPSETTING(    0x08, "ExtraBall 400000" )
  7538.     PORT_DIPSETTING(    0x06, "ExtraBall 500000" )
  7539.     PORT_DIPSETTING(    0x04, "ExtraBall 600000" )
  7540.     PORT_DIPSETTING(    0x02, "ExtraBall 700000" )
  7541.     PORT_DIPSETTING(    0x00, "None" )
  7542.  
  7543.     PORT_DIPNAME( 0x20, 0x20, "Match" )
  7544.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  7545.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  7546.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  7547.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  7548.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7549.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Lives ) )
  7550.     PORT_DIPSETTING(    0x80, "3" )
  7551.     PORT_DIPSETTING(    0x00, "5" )
  7552.  
  7553. PORT_START    /* DSW3 */
  7554.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )        //??
  7555.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  7556.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7557.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  7558.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  7559.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7560.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) )
  7561.     PORT_DIPSETTING(    0x04, "1" )
  7562.     PORT_DIPSETTING(    0x0c, "2" )
  7563.     PORT_DIPSETTING(    0x08, "3" )
  7564.     PORT_DIPSETTING(    0x00, "None" )
  7565.     PORT_DIPNAME( 0x10, 0x10, "Allow Continue" )
  7566.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  7567.     PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
  7568.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
  7569.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  7570.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7571.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
  7572.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  7573.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7574.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
  7575.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  7576.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7577.  
  7578. INPUT_PORTS_END
  7579.  
  7580. /***************************************************************************/
  7581.  
  7582. MACHINE_DRIVER_7759( machine_driver_timscanr, \
  7583.     timscanr_readmem,timscanr_writemem,timscanr_init_machine, gfx8,upd7759_interface )
  7584.  
  7585. /***************************************************************************/
  7586.  
  7587. // sys16B
  7588. ROM_START( toryumon )
  7589.     ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
  7590.     ROM_LOAD_EVEN( "17689",  0x00000, 0x20000, 0x4f0dee19 )
  7591.     ROM_LOAD_ODD ( "17688",  0x00000, 0x20000, 0x717d81c7 )
  7592.  
  7593.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  7594.     ROM_LOAD( "17700", 0x00000, 0x40000, 0x8f288b37 )
  7595.     ROM_LOAD( "17701", 0x40000, 0x40000, 0x6dfb025b )
  7596.     ROM_LOAD( "17702", 0x80000, 0x40000, 0xae0b7eab )
  7597.  
  7598.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  7599.     ROM_LOAD( "17692", 0x00000, 0x20000, 0x543c4327 )
  7600.     ROM_LOAD( "17695", 0x20000, 0x20000, 0xee60f244 )
  7601.     ROM_LOAD( "17693", 0x40000, 0x20000, 0x4a350b3e )
  7602.     ROM_LOAD( "17696", 0x60000, 0x20000, 0x6edb54f1 )
  7603.     ROM_LOAD( "17694", 0x80000, 0x20000, 0xb296d71d )
  7604.     ROM_LOAD( "17697", 0xa0000, 0x20000, 0x6ccb7b28 )
  7605.     ROM_LOAD( "17698", 0xc0000, 0x20000, 0xcd4dfb82 )
  7606.     ROM_LOAD( "17699", 0xe0000, 0x20000, 0x2694ecce )
  7607.  
  7608.  
  7609.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  7610.     ROM_LOAD( "17691", 0x00000,  0x08000, 0x14205388 )
  7611.     ROM_LOAD( "17690", 0x10000,  0x40000, 0x4f9ba4e4 )
  7612. ROM_END
  7613.  
  7614. /***************************************************************************/
  7615.  
  7616. static struct MemoryReadAddress toryumon_readmem[] =
  7617. {
  7618.     { 0x000000, 0x03ffff, MRA_ROM },
  7619.     { 0x3e2000, 0x3e2003, MRA_EXTRAM },
  7620.     { 0x400000, 0x40ffff, MRA_TILERAM },
  7621.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  7622.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  7623.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  7624.  
  7625.     { 0xe40000, 0xe40001, MRA_EXTRAM2 },
  7626.  
  7627.     { 0xe41002, 0xe41003, io_player1_r },
  7628.     { 0xe41004, 0xe41005, MRA_NOP },
  7629.     { 0xe41006, 0xe41007, io_player2_r },
  7630.     { 0xe41000, 0xe41001, io_service_r },
  7631.     { 0xe42002, 0xe42003, io_dip1_r },
  7632.     { 0xe42000, 0xe42001, io_dip2_r },
  7633.  
  7634.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  7635.     {-1}
  7636. };
  7637.  
  7638. static struct MemoryWriteAddress toryumon_writemem[] =
  7639. {
  7640.     { 0x000000, 0x03ffff, MWA_ROM },
  7641.     { 0x3e2000, 0x3e2003, MWA_EXTRAM },
  7642.     { 0x400000, 0x40ffff, MWA_TILERAM },
  7643.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  7644.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  7645.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  7646.     { 0xe40000, 0xe40001, MWA_EXTRAM2 },
  7647.     { 0xfe0006, 0xfe0007, sound_command_w },
  7648.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  7649.     {-1}
  7650. };
  7651. /***************************************************************************/
  7652.  
  7653. static void toryumon_update_proc( void ){
  7654.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  7655.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  7656.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  7657.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  7658.  
  7659.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  7660.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  7661.  
  7662.     sys16_tile_bank0 = READ_WORD( &sys16_extraram[0x0000] )&0xf;
  7663.     sys16_tile_bank1 = READ_WORD( &sys16_extraram[0x0002] )&0xf;
  7664.  
  7665.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  7666. }
  7667.  
  7668. static void toryumon_init_machine( void ){
  7669.     static int bank[16] = {00,0x02,0x04,0x06,0x08,0x0a,0x0c,0x0e,00,00,00,00,00,00,00,00};
  7670.     sys16_obj_bank = bank;
  7671.  
  7672.     sys16_update_proc = toryumon_update_proc;
  7673. }
  7674.  
  7675. static void init_toryumon(void)
  7676. {
  7677.     sys16_onetime_init_machine();
  7678.     sys16_sprite_decode( 4,0x40000 );
  7679. }
  7680. /***************************************************************************/
  7681.  
  7682. INPUT_PORTS_START( toryumon )
  7683.     SYS16_JOY1
  7684.     SYS16_JOY2
  7685.     SYS16_SERVICE
  7686.     SYS16_COINAGE
  7687.  
  7688. PORT_START    /* DSW1 */
  7689.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
  7690.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  7691.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7692.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) )
  7693.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  7694.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7695.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
  7696.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  7697.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7698.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
  7699.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  7700.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7701.     PORT_DIPNAME( 0x10, 0x10, "VS-Mode Battle" )
  7702.     PORT_DIPSETTING(    0x10, "1" )
  7703.     PORT_DIPSETTING(    0x00, "3" )
  7704.     PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Difficulty ) )
  7705.     PORT_DIPSETTING(    0xc0, "Easy" )
  7706.     PORT_DIPSETTING(    0xe0, "Normal" )
  7707.     PORT_DIPSETTING(    0xa0, "Hard" )
  7708.     PORT_DIPSETTING(    0x80, "Hard+1" )
  7709.     PORT_DIPSETTING(    0x60, "Hard+2" )
  7710.     PORT_DIPSETTING(    0x40, "Hard+3" )
  7711.     PORT_DIPSETTING(    0x20, "Hard+4" )
  7712.     PORT_DIPSETTING(    0x00, "Hard+5" )
  7713. INPUT_PORTS_END
  7714.  
  7715. /***************************************************************************/
  7716.  
  7717. MACHINE_DRIVER_7759( machine_driver_toryumon, \
  7718.     toryumon_readmem,toryumon_writemem,toryumon_init_machine, gfx4,upd7759_interface )
  7719.  
  7720. /***************************************************************************/
  7721.  
  7722. // sys16B
  7723. ROM_START( tturf )
  7724.     ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
  7725.     ROM_LOAD_EVEN( "12327.7a",  0x00000, 0x20000, 0x0376c593 )
  7726.     ROM_LOAD_ODD ( "12326.5a",  0x00000, 0x20000, 0xf998862b )
  7727.  
  7728.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  7729.     ROM_LOAD( "12268.14a", 0x00000, 0x10000, 0xe0dac07f )
  7730.     ROM_LOAD( "12269.15a", 0x10000, 0x10000, 0x457a8790 )
  7731.     ROM_LOAD( "12270.16a", 0x20000, 0x10000, 0x69fc025b )
  7732.  
  7733.     ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
  7734.     ROM_LOAD( "12279.1b", 0x00000, 0x10000, 0x7a169fb1 )
  7735.     ROM_LOAD( "12283.5b", 0x10000, 0x10000, 0xae0fa085 )
  7736.     ROM_LOAD( "12278.2b", 0x20000, 0x10000, 0x961d06b7 )
  7737.     ROM_LOAD( "12282.6b", 0x30000, 0x10000, 0xe8671ee1 )
  7738.     ROM_LOAD( "12277.3b", 0x40000, 0x10000, 0xf16b6ba2 )
  7739.     ROM_LOAD( "12281.7b", 0x50000, 0x10000, 0x1ef1077f )
  7740.     ROM_LOAD( "12276.4b", 0x60000, 0x10000, 0x838bd71f )
  7741.     ROM_LOAD( "12280.8b", 0x70000, 0x10000, 0x639a57cb )
  7742.  
  7743.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  7744.     ROM_LOAD( "12328.10a", 0x0000, 0x8000, 0x00000000 )
  7745.     ROM_LOAD( "12329.11a", 0x10000, 0x10000, 0xed9a686d )        // speech
  7746.     ROM_LOAD( "12330.12a", 0x20000, 0x10000, 0xfb762bca )
  7747.  
  7748. ROM_END
  7749.  
  7750. // sys16B
  7751. ROM_START( tturfu )
  7752.     ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
  7753.     ROM_LOAD_EVEN( "epr12266.bin",  0x00000, 0x10000, 0xf549def8 )
  7754.     ROM_LOAD_ODD ( "epr12264.bin",  0x00000, 0x10000, 0xf7cdb289 )
  7755.     ROM_LOAD_EVEN( "epr12267.bin",  0x20000, 0x10000, 0x3c3ce191 )
  7756.     ROM_LOAD_ODD ( "epr12265.bin",  0x20000, 0x10000, 0x8cdadd9a )
  7757.  
  7758.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  7759.     ROM_LOAD( "12268.14a", 0x00000, 0x10000, 0xe0dac07f )
  7760.     ROM_LOAD( "12269.15a", 0x10000, 0x10000, 0x457a8790 )
  7761.     ROM_LOAD( "12270.16a", 0x20000, 0x10000, 0x69fc025b )
  7762.  
  7763.     ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
  7764.     ROM_LOAD( "12279.1b", 0x00000, 0x10000, 0x7a169fb1 )
  7765.     ROM_LOAD( "12283.5b", 0x10000, 0x10000, 0xae0fa085 )
  7766.     ROM_LOAD( "12278.2b", 0x20000, 0x10000, 0x961d06b7 )
  7767.     ROM_LOAD( "12282.6b", 0x30000, 0x10000, 0xe8671ee1 )
  7768.     ROM_LOAD( "12277.3b", 0x40000, 0x10000, 0xf16b6ba2 )
  7769.     ROM_LOAD( "12281.7b", 0x50000, 0x10000, 0x1ef1077f )
  7770.     ROM_LOAD( "12276.4b", 0x60000, 0x10000, 0x838bd71f )
  7771.     ROM_LOAD( "12280.8b", 0x70000, 0x10000, 0x639a57cb )
  7772.  
  7773.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  7774.     ROM_LOAD( "epr12271.bin", 0x0000,  0x8000, 0x99671e52 )
  7775.     ROM_LOAD( "epr12272.bin", 0x10000, 0x8000, 0x7cf7e69f )
  7776.     ROM_LOAD( "epr12273.bin", 0x18000, 0x8000, 0x28f0bb8b )
  7777.     ROM_LOAD( "epr12274.bin", 0x20000, 0x8000, 0x8207f0c4 )
  7778.     ROM_LOAD( "epr12275.bin", 0x28000, 0x8000, 0x182f3c3d )
  7779.  
  7780. ROM_END
  7781.  
  7782. /***************************************************************************/
  7783. static READ_HANDLER( tt_io_player1_r ){ return input_port_0_r( offset ) << 8; }
  7784. static READ_HANDLER( tt_io_player2_r ){ return input_port_1_r( offset ) << 8; }
  7785. static READ_HANDLER( tt_io_service_r ){ return input_port_2_r( offset ) << 8; }
  7786.  
  7787. static struct MemoryReadAddress tturf_readmem[] =
  7788. {
  7789.     { 0x000000, 0x03ffff, MRA_ROM },
  7790.     { 0x2001e6, 0x2001e7, tt_io_service_r },
  7791.     { 0x2001e8, 0x2001e9, tt_io_player1_r },
  7792.     { 0x2001ea, 0x2001eb, tt_io_player2_r },
  7793.     { 0x200000, 0x203fff, MRA_EXTRAM },
  7794.     { 0x300000, 0x300fff, MRA_SPRITERAM },
  7795.     { 0x400000, 0x40ffff, MRA_TILERAM },
  7796.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  7797.     { 0x500000, 0x500fff, MRA_PALETTERAM },
  7798.  
  7799.     { 0x602002, 0x602003, io_dip1_r },
  7800.     { 0x602000, 0x602001, io_dip2_r },
  7801.     {-1}
  7802. };
  7803.  
  7804. static struct MemoryWriteAddress tturf_writemem[] =
  7805. {
  7806.     { 0x000000, 0x03ffff, MWA_ROM },
  7807.     { 0x200000, 0x203fff, MWA_EXTRAM },
  7808.     { 0x300000, 0x300fff, MWA_SPRITERAM },
  7809.     { 0x400000, 0x40ffff, MWA_TILERAM },
  7810.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  7811.     { 0x500000, 0x500fff, MWA_PALETTERAM },
  7812.     { 0x600000, 0x600005, MWA_EXTRAM2 },
  7813. //    { 0x600006, 0x600007, sound_command_w },
  7814.     {-1}
  7815. };
  7816. /***************************************************************************/
  7817. static void tturf_update_proc( void ){
  7818.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  7819.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  7820.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  7821.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  7822.  
  7823.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  7824.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  7825.  
  7826.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  7827. }
  7828.  
  7829. static void tturf_init_machine( void ){
  7830.     static int bank[16] = {00,00,0x02,00,0x04,00,0x06,00,00,00,00,00,00,00,00,00};
  7831.     sys16_obj_bank = bank;
  7832.     sys16_spritelist_end=0xc000;
  7833.  
  7834.     sys16_update_proc = tturf_update_proc;
  7835. }
  7836.  
  7837. static void tturfu_init_machine( void ){
  7838.     static int bank[16] = {00,00,00,00,00,00,00,00,00,00,00,02,00,04,06,00};
  7839.     sys16_obj_bank = bank;
  7840.     sys16_spritelist_end=0xc000;
  7841.  
  7842.     sys16_update_proc = tturf_update_proc;
  7843. }
  7844.  
  7845. static void init_tturf(void)
  7846. {
  7847.     sys16_onetime_init_machine();
  7848.     sys16_sprite_decode( 4,0x20000 );
  7849. }
  7850. /***************************************************************************/
  7851.  
  7852. INPUT_PORTS_START( tturf )
  7853.     SYS16_JOY1
  7854.     SYS16_JOY2
  7855.     SYS16_SERVICE
  7856.     SYS16_COINAGE
  7857.  
  7858. PORT_START    /* DSW1 */
  7859.     PORT_DIPNAME( 0x03, 0x00, "Continues" )
  7860.     PORT_DIPSETTING(    0x00, "None" )
  7861.     PORT_DIPSETTING(    0x01, "3" )
  7862.     PORT_DIPSETTING(    0x02, "Unlimited" )
  7863.     PORT_DIPSETTING(    0x03, "Unlimited" )
  7864.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
  7865.     PORT_DIPSETTING(    0x08, "Easy" )
  7866.     PORT_DIPSETTING(    0x0c, "Normal" )
  7867.     PORT_DIPSETTING(    0x04, "Hard" )
  7868.     PORT_DIPSETTING(    0x00, "Hardest" )
  7869.     PORT_DIPNAME( 0x30, 0x20, "Starting Energy" )
  7870.     PORT_DIPSETTING(    0x00, "3" )
  7871.     PORT_DIPSETTING(    0x10, "4" )
  7872.     PORT_DIPSETTING(    0x20, "6" )
  7873.     PORT_DIPSETTING(    0x30, "8" )
  7874.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
  7875.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  7876.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  7877.     PORT_DIPNAME( 0x80, 0x00, "Bonus Energy" )
  7878.     PORT_DIPSETTING(    0x80, "1" )
  7879.     PORT_DIPSETTING(    0x00, "2" )
  7880. INPUT_PORTS_END
  7881.  
  7882. /***************************************************************************/
  7883.  
  7884. MACHINE_DRIVER_7759( machine_driver_tturf, \
  7885.     tturf_readmem,tturf_writemem,tturf_init_machine, gfx1,upd7759_interface )
  7886.  
  7887. MACHINE_DRIVER_7759( machine_driver_tturfu, \
  7888.     tturf_readmem,tturf_writemem,tturfu_init_machine, gfx1,upd7759_interface )
  7889.  
  7890. /***************************************************************************/
  7891. // sys16B
  7892. ROM_START( tturfbl )
  7893.     ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
  7894.     ROM_LOAD_EVEN( "tt042197.rom", 0x00000, 0x10000, 0xdeee5af1 )
  7895.     ROM_LOAD_ODD ( "tt06c794.rom", 0x00000, 0x10000, 0x90e6a95a )
  7896.     ROM_LOAD_EVEN( "tt030be3.rom", 0x20000, 0x10000, 0x100264a2 )
  7897.     ROM_LOAD_ODD ( "tt05ef8a.rom", 0x20000, 0x10000, 0xf787a948 )
  7898.  
  7899.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  7900.     ROM_LOAD( "tt1574b3.rom", 0x00000, 0x10000, 0xe9e630da )
  7901.     ROM_LOAD( "tt16cf44.rom", 0x10000, 0x10000, 0x4c467735 )
  7902.     ROM_LOAD( "tt17d59e.rom", 0x20000, 0x10000, 0x60c0f2fe )
  7903.  
  7904.     ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
  7905.     ROM_LOAD( "12279.1b", 0x00000, 0x10000, 0x7a169fb1 )
  7906.     ROM_LOAD( "12283.5b", 0x10000, 0x10000, 0xae0fa085 )
  7907.     ROM_LOAD( "12278.2b", 0x20000, 0x10000, 0x961d06b7 )
  7908.     ROM_LOAD( "12282.6b", 0x30000, 0x10000, 0xe8671ee1 )
  7909.     ROM_LOAD( "12277.3b", 0x40000, 0x10000, 0xf16b6ba2 )
  7910.     ROM_LOAD( "12281.7b", 0x50000, 0x10000, 0x1ef1077f )
  7911.     ROM_LOAD( "12276.4b", 0x60000, 0x10000, 0x838bd71f )
  7912.     ROM_LOAD( "12280.8b", 0x70000, 0x10000, 0x639a57cb )
  7913.  
  7914.     ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
  7915.     ROM_LOAD( "tt014d68.rom", 0x00000, 0x08000, 0xd4aab1d9 )
  7916.     ROM_CONTINUE(             0x10000, 0x08000 )
  7917.     ROM_LOAD( "tt0246ff.rom", 0x18000, 0x10000, 0xbb4bba8f )
  7918. ROM_END
  7919.  
  7920. /***************************************************************************/
  7921.  
  7922. static struct MemoryReadAddress tturfbl_readmem[] =
  7923. {
  7924.     { 0x000000, 0x03ffff, MRA_ROM },
  7925.     { 0x2001e6, 0x2001e7, tt_io_service_r },
  7926.     { 0x2001e8, 0x2001e9, tt_io_player1_r },
  7927.     { 0x2001ea, 0x2001eb, tt_io_player2_r },
  7928.     { 0x200000, 0x203fff, MRA_EXTRAM },
  7929.     { 0x300000, 0x300fff, MRA_SPRITERAM },
  7930.     { 0x400000, 0x40ffff, MRA_TILERAM },
  7931.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  7932.     { 0x500000, 0x500fff, MRA_PALETTERAM },
  7933.     { 0x600002, 0x600003, io_dip1_r },
  7934.     { 0x600000, 0x600001, io_dip2_r },
  7935.     { 0x601002, 0x601003, io_player1_r },
  7936.     { 0x601004, 0x601005, io_player2_r },
  7937.     { 0x601000, 0x601001, io_service_r },
  7938.     { 0x602002, 0x602003, io_dip1_r },
  7939.     { 0x602000, 0x602001, io_dip2_r },
  7940.     { 0xc46000, 0xc4601f, MRA_EXTRAM3 },
  7941.     {-1}
  7942. };
  7943.  
  7944. static struct MemoryWriteAddress tturfbl_writemem[] =
  7945. {
  7946.     { 0x000000, 0x03ffff, MWA_ROM },
  7947.     { 0x200000, 0x203fff, MWA_EXTRAM },
  7948.     { 0x300000, 0x300fff, MWA_SPRITERAM },
  7949.     { 0x400000, 0x40ffff, MWA_TILERAM },
  7950.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  7951.     { 0x500000, 0x500fff, MWA_PALETTERAM },
  7952.     { 0x600000, 0x600005, MWA_EXTRAM2 },
  7953.     { 0x600006, 0x600007, sound_command_w },
  7954.     { 0xc44000, 0xc44001, MWA_NOP },
  7955.     { 0xc46000, 0xc4601f, MWA_EXTRAM3 },
  7956.     {-1}
  7957. };
  7958.  
  7959. /***************************************************************************/
  7960.  
  7961. static void tturfbl_update_proc( void ){
  7962.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] ) & 0x01ff;
  7963.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] ) & 0x01ff;
  7964.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  7965.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  7966.  
  7967.  
  7968.     {
  7969.         int data1,data2;
  7970.  
  7971.         data1 = READ_WORD( &sys16_textram[0x0e80] );
  7972.         data2 = READ_WORD( &sys16_textram[0x0e82] );
  7973.  
  7974.         sys16_fg_page[3] = data1>>12;
  7975.         sys16_bg_page[3] = (data1>>8)&0xf;
  7976.         sys16_fg_page[1] = (data1>>4)&0xf;
  7977.         sys16_bg_page[1] = data1&0xf;
  7978.  
  7979.         sys16_fg_page[2] = data2>>12;
  7980.         sys16_bg_page[2] = (data2>>8)&0xf;
  7981.         sys16_fg_page[0] = (data2>>4)&0xf;
  7982.         sys16_bg_page[0] = data2&0xf;
  7983.     }
  7984.  
  7985.  
  7986.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  7987. }
  7988.  
  7989. static void tturfbl_init_machine( void ){
  7990.     static int bank[16] = {00,00,00,00,00,00,00,0x06,00,00,00,0x04,00,0x02,00,00};
  7991.     sys16_obj_bank = bank;
  7992.     sys16_sprxoffset = -0x48;
  7993.     sys16_spritelist_end=0xc000;
  7994.  
  7995.     sys16_update_proc = tturfbl_update_proc;
  7996. }
  7997.  
  7998. static void init_tturfbl(void)
  7999. {
  8000.     int i;
  8001.  
  8002.     sys16_onetime_init_machine();
  8003.  
  8004.     /* invert the graphics bits on the tiles */
  8005.     for (i = 0; i < 0x30000; i++)
  8006.         memory_region(REGION_GFX1)[i] ^= 0xff;
  8007.  
  8008.     sys16_sprite_decode( 4,0x20000 );
  8009. }
  8010. /***************************************************************************/
  8011. // sound ??
  8012. MACHINE_DRIVER_7759( machine_driver_tturfbl, \
  8013.     tturfbl_readmem,tturfbl_writemem,tturfbl_init_machine, gfx1,upd7759_interface )
  8014.  
  8015. /***************************************************************************/
  8016. // sys16B
  8017. ROM_START( wb3 )
  8018.     ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
  8019.     ROM_LOAD_EVEN( "epr12259.a7", 0x000000, 0x20000, 0x54927c7e )
  8020.     ROM_LOAD_ODD ( "epr12258.a5", 0x000000, 0x20000, 0x01f5898c )
  8021.  
  8022.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  8023.     ROM_LOAD( "epr12124.a14", 0x00000, 0x10000, 0xdacefb6f )
  8024.     ROM_LOAD( "epr12125.a15", 0x10000, 0x10000, 0x9fc36df7 )
  8025.     ROM_LOAD( "epr12126.a16", 0x20000, 0x10000, 0xa693fd94 )
  8026.  
  8027.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  8028.     ROM_LOAD( "epr12093.b4", 0x000000, 0x010000, 0x4891e7bb )
  8029.     ROM_LOAD( "epr12097.b8", 0x010000, 0x010000, 0xe645902c )
  8030.     ROM_LOAD( "epr12091.b2", 0x020000, 0x010000, 0x8409a243 )
  8031.     ROM_LOAD( "epr12095.b6", 0x030000, 0x010000, 0xe774ec2c )
  8032.     ROM_LOAD( "epr12090.b1", 0x040000, 0x010000, 0xaeeecfca )
  8033.     ROM_LOAD( "epr12094.b5", 0x050000, 0x010000, 0x615e4927 )
  8034.     ROM_LOAD( "epr12092.b3", 0x060000, 0x010000, 0x5c2f0d90 )
  8035.     ROM_LOAD( "epr12096.b7", 0x070000, 0x010000, 0x0cd59d6e )
  8036.  
  8037.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  8038.     ROM_LOAD( "epr12127.a10", 0x0000, 0x8000, 0x0bb901bb )
  8039. ROM_END
  8040.  
  8041. ROM_START( wb3a )
  8042.     ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
  8043. // Custom CPU 317-0089
  8044.     ROM_LOAD_EVEN( "epr12137.a7", 0x000000, 0x20000, 0x6f81238e )
  8045.     ROM_LOAD_ODD ( "epr12136.a5", 0x000000, 0x20000, 0x4cf05003 )
  8046.  
  8047.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  8048.     ROM_LOAD( "epr12124.a14", 0x00000, 0x10000, 0xdacefb6f )
  8049.     ROM_LOAD( "epr12125.a15", 0x10000, 0x10000, 0x9fc36df7 )
  8050.     ROM_LOAD( "epr12126.a16", 0x20000, 0x10000, 0xa693fd94 )
  8051.  
  8052.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  8053.     ROM_LOAD( "epr12093.b4", 0x000000, 0x010000, 0x4891e7bb )
  8054.     ROM_LOAD( "epr12097.b8", 0x010000, 0x010000, 0xe645902c )
  8055.     ROM_LOAD( "epr12091.b2", 0x020000, 0x010000, 0x8409a243 )
  8056.     ROM_LOAD( "epr12095.b6", 0x030000, 0x010000, 0xe774ec2c )
  8057.     ROM_LOAD( "epr12090.b1", 0x040000, 0x010000, 0xaeeecfca )
  8058.     ROM_LOAD( "epr12094.b5", 0x050000, 0x010000, 0x615e4927 )
  8059.     ROM_LOAD( "epr12092.b3", 0x060000, 0x010000, 0x5c2f0d90 )
  8060.     ROM_LOAD( "epr12096.b7", 0x070000, 0x010000, 0x0cd59d6e )
  8061.  
  8062.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  8063.     ROM_LOAD( "epr12127.a10", 0x0000, 0x8000, 0x0bb901bb )
  8064. ROM_END
  8065.  
  8066. /***************************************************************************/
  8067.  
  8068. static struct MemoryReadAddress wb3_readmem[] =
  8069. {
  8070.     { 0x000000, 0x03ffff, MRA_ROM },
  8071.     { 0x400000, 0x40ffff, MRA_TILERAM },
  8072.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  8073.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  8074.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  8075.     { 0xc41002, 0xc41003, io_player1_r },
  8076.     { 0xc41006, 0xc41007, io_player2_r },
  8077.     { 0xc41000, 0xc41001, io_service_r },
  8078.     { 0xc42002, 0xc42003, io_dip1_r },
  8079.     { 0xc42000, 0xc42001, io_dip2_r },
  8080.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  8081.     {-1}
  8082. };
  8083.  
  8084. static WRITE_HANDLER( wb3_sound_command_w )
  8085. {
  8086.     if( (data&0xff000000)==0 )
  8087.         sound_command_w(offset,data>>8);
  8088. }
  8089.  
  8090. static struct MemoryWriteAddress wb3_writemem[] =
  8091. {
  8092.     { 0x000000, 0x03ffff, MWA_ROM },
  8093.     { 0x3f0000, 0x3f0003, MWA_NOP },
  8094.     { 0x400000, 0x40ffff, MWA_TILERAM },
  8095.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  8096.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  8097.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  8098.     { 0xc40000, 0xc40001, MWA_EXTRAM2 },
  8099.     { 0xffc008, 0xffc009, wb3_sound_command_w },
  8100.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  8101.     {-1}
  8102. };
  8103. /***************************************************************************/
  8104.  
  8105. static void wb3_update_proc( void ){
  8106.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  8107.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  8108.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  8109.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  8110.  
  8111.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  8112.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  8113.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  8114. }
  8115.  
  8116.  
  8117. static void wb3_init_machine( void ){
  8118.     static int bank[16] = {4,0,2,0,6,0,0,0x06,0,0,0,0x04,0,0x02,0,0};
  8119.  
  8120.     sys16_obj_bank = bank;
  8121.  
  8122.     sys16_update_proc = wb3_update_proc;
  8123. }
  8124.  
  8125. static void init_wb3(void)
  8126. {
  8127.     sys16_onetime_init_machine();
  8128.     sys16_sprite_decode( 4,0x20000 );
  8129. }
  8130.  
  8131. /***************************************************************************/
  8132.  
  8133. INPUT_PORTS_START( wb3 )
  8134.     SYS16_JOY1
  8135.     SYS16_JOY2
  8136.     SYS16_SERVICE
  8137.     SYS16_COINAGE
  8138.  
  8139. PORT_START    /* DSW1 */
  8140.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  8141.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  8142.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  8143.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  8144.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  8145.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  8146.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  8147.     PORT_DIPSETTING(    0x00, "2" )
  8148.     PORT_DIPSETTING(    0x0c, "3" )
  8149.     PORT_DIPSETTING(    0x08, "4" )
  8150.     PORT_DIPSETTING(    0x04, "5" )
  8151.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )        //??
  8152.     PORT_DIPSETTING(    0x10, "5000/10000/18000/30000" )
  8153.     PORT_DIPSETTING(    0x00, "5000/15000/30000" )
  8154.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  8155.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  8156.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  8157.     PORT_DIPNAME( 0x40, 0x40, "Allow Round Select" )
  8158.     PORT_DIPSETTING(    0x40, DEF_STR( No ) )
  8159.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )            // no collision though
  8160.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
  8161.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  8162.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  8163.  
  8164. INPUT_PORTS_END
  8165.  
  8166. /***************************************************************************/
  8167.  
  8168. MACHINE_DRIVER( machine_driver_wb3, \
  8169.     wb3_readmem,wb3_writemem,wb3_init_machine, gfx1 )
  8170.  
  8171. /***************************************************************************/
  8172. // sys16B
  8173. ROM_START( wb3bl )
  8174.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  8175.     ROM_LOAD_EVEN( "wb3_03", 0x000000, 0x10000, 0x0019ab3b )
  8176.     ROM_LOAD_ODD ( "wb3_05", 0x000000, 0x10000, 0x196e17ee )
  8177.     ROM_LOAD_EVEN( "wb3_02", 0x020000, 0x10000, 0xc87350cb )
  8178.     ROM_LOAD_ODD ( "wb3_04", 0x020000, 0x10000, 0x565d5035 )
  8179.  
  8180.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  8181.     ROM_LOAD( "wb3_14", 0x00000, 0x10000, 0xd3f20bca )
  8182.     ROM_LOAD( "wb3_15", 0x10000, 0x10000, 0x96ff9d52 )
  8183.     ROM_LOAD( "wb3_16", 0x20000, 0x10000, 0xafaf0d31 )
  8184.  
  8185.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  8186.     ROM_LOAD( "epr12093.b4", 0x000000, 0x010000, 0x4891e7bb )
  8187.     ROM_LOAD( "epr12097.b8", 0x010000, 0x010000, 0xe645902c )
  8188.     ROM_LOAD( "epr12091.b2", 0x020000, 0x010000, 0x8409a243 )
  8189.     ROM_LOAD( "epr12095.b6", 0x030000, 0x010000, 0xe774ec2c )
  8190.     ROM_LOAD( "epr12090.b1", 0x040000, 0x010000, 0xaeeecfca )
  8191.     ROM_LOAD( "epr12094.b5", 0x050000, 0x010000, 0x615e4927 )
  8192.     ROM_LOAD( "epr12092.b3", 0x060000, 0x010000, 0x5c2f0d90 )
  8193.     ROM_LOAD( "epr12096.b7", 0x070000, 0x010000, 0x0cd59d6e )
  8194.  
  8195.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  8196.     ROM_LOAD( "epr12127.a10", 0x0000, 0x8000, 0x0bb901bb )
  8197. ROM_END
  8198.  
  8199. /***************************************************************************/
  8200.  
  8201. static struct MemoryReadAddress wb3bl_readmem[] =
  8202. {
  8203.     { 0x000000, 0x03ffff, MRA_ROM },
  8204.     { 0x400000, 0x40ffff, MRA_TILERAM },
  8205.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  8206.     { 0x440000, 0x440fff, MRA_SPRITERAM },
  8207.     { 0x840000, 0x840fff, MRA_PALETTERAM },
  8208.     { 0xc41002, 0xc41003, io_player1_r },
  8209.     { 0xc41004, 0xc41005, io_player2_r },
  8210.     { 0xc41000, 0xc41001, io_service_r },
  8211.     { 0xc42002, 0xc42003, io_dip1_r },
  8212.     { 0xc42000, 0xc42001, io_dip2_r },
  8213.     { 0xc46000, 0xc4601f, MRA_EXTRAM3 },
  8214.     { 0xff0000, 0xffffff, MRA_WORKINGRAM },
  8215.     {-1}
  8216. };
  8217.  
  8218. static struct MemoryWriteAddress wb3bl_writemem[] =
  8219. {
  8220.     { 0x000000, 0x03ffff, MWA_ROM },
  8221.     { 0x3f0000, 0x3f0003, MWA_NOP },
  8222.     { 0x400000, 0x40ffff, MWA_TILERAM },
  8223.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  8224.     { 0x440000, 0x440fff, MWA_SPRITERAM },
  8225.     { 0x840000, 0x840fff, MWA_PALETTERAM },
  8226.     { 0xc42006, 0xc42007, sound_command_w },
  8227.     { 0xc40000, 0xc40001, MWA_EXTRAM2 },
  8228.     { 0xc44000, 0xc44001, MWA_NOP },
  8229.     { 0xc46000, 0xc4601f, MWA_EXTRAM3 },
  8230.     { 0xff0000, 0xffffff, MWA_WORKINGRAM },
  8231.     {-1}
  8232. };
  8233.  
  8234. /***************************************************************************/
  8235.  
  8236. static void wb3bl_update_proc( void ){
  8237.     sys16_fg_scrollx = READ_WORD( &sys16_workingram[0xc030] );
  8238.     sys16_bg_scrollx = READ_WORD( &sys16_workingram[0xc038] );
  8239.     sys16_fg_scrolly = READ_WORD( &sys16_workingram[0xc032] );
  8240.     sys16_bg_scrolly = READ_WORD( &sys16_workingram[0xc03c] );
  8241.  
  8242.     set_fg_page( READ_WORD( &sys16_textram[0x0ff6] ) );
  8243.     set_bg_page( READ_WORD( &sys16_textram[0x0ff4] ) );
  8244.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  8245. }
  8246.  
  8247. static void wb3bl_init_machine( void ){
  8248.     static int bank[16] = {4,0,2,0,6,0,0,0x06,0,0,0,0x04,0,0x02,0,0};
  8249.  
  8250.     sys16_obj_bank = bank;
  8251.  
  8252.     patch_code( 0x17058, 0x4e );
  8253.     patch_code( 0x17059, 0xb9 );
  8254.     patch_code( 0x1705a, 0x00 );
  8255.     patch_code( 0x1705b, 0x00 );
  8256.     patch_code( 0x1705c, 0x09 );
  8257.     patch_code( 0x1705d, 0xdc );
  8258.     patch_code( 0x1705e, 0x4e );
  8259.     patch_code( 0x1705f, 0xf9 );
  8260.     patch_code( 0x17060, 0x00 );
  8261.     patch_code( 0x17061, 0x01 );
  8262.     patch_code( 0x17062, 0x70 );
  8263.     patch_code( 0x17063, 0xe0 );
  8264.     patch_code( 0x1a3a, 0x31 );
  8265.     patch_code( 0x1a3b, 0x7c );
  8266.     patch_code( 0x1a3c, 0x80 );
  8267.     patch_code( 0x1a3d, 0x00 );
  8268.     patch_code( 0x23df8, 0x14 );
  8269.     patch_code( 0x23df9, 0x41 );
  8270.     patch_code( 0x23dfa, 0x10 );
  8271.     patch_code( 0x23dfd, 0x14 );
  8272.     patch_code( 0x23dff, 0x1c );
  8273.  
  8274.     sys16_update_proc = wb3bl_update_proc;
  8275. }
  8276.  
  8277. static void init_wb3bl(void)
  8278. {
  8279.     int i;
  8280.  
  8281.     sys16_onetime_init_machine();
  8282.  
  8283.     /* invert the graphics bits on the tiles */
  8284.     for (i = 0; i < 0x30000; i++)
  8285.         memory_region(REGION_GFX1)[i] ^= 0xff;
  8286.  
  8287.     sys16_sprite_decode( 4,0x20000 );
  8288. }
  8289.  
  8290. /***************************************************************************/
  8291.  
  8292. MACHINE_DRIVER( machine_driver_wb3bl, \
  8293.     wb3bl_readmem,wb3bl_writemem,wb3bl_init_machine, gfx1 )
  8294.  
  8295. /***************************************************************************/
  8296. // sys16B
  8297. ROM_START( wrestwar )
  8298.     ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
  8299.     ROM_LOAD_EVEN( "ww.a7", 0x00000, 0x20000, 0xeeaba126 )
  8300.     ROM_LOAD_ODD ( "ww.a5", 0x00000, 0x20000, 0x6714600a )
  8301.     /* empty 0x40000 - 0x80000 */
  8302.     ROM_LOAD_EVEN( "ww.a8", 0x80000, 0x20000, 0xb77ba665 )
  8303.     ROM_LOAD_ODD ( "ww.a6", 0x80000, 0x20000, 0xddf075cb )
  8304.  
  8305.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  8306.     ROM_LOAD( "ww.a14", 0x00000, 0x20000, 0x6a821ab9 )
  8307.     ROM_LOAD( "ww.a15", 0x20000, 0x20000, 0x2b1a0751 )
  8308.     ROM_LOAD( "ww.a16", 0x40000, 0x20000, 0xf6e190fe )
  8309.  
  8310.     ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
  8311.     ROM_LOAD( "ww.b1",  0x000000, 0x20000, 0xffa7d368 )
  8312.     ROM_LOAD( "ww.b5",  0x020000, 0x20000, 0x8d7794c1 )
  8313.     ROM_LOAD( "ww.b2",  0x040000, 0x20000, 0x0ed343f2 )
  8314.     ROM_LOAD( "ww.b6",  0x060000, 0x20000, 0x99458d58 )
  8315.     ROM_LOAD( "ww.b3",  0x080000, 0x20000, 0x3087104d )
  8316.     ROM_LOAD( "ww.b7",  0x0a0000, 0x20000, 0xabcf9bed )
  8317.     ROM_LOAD( "ww.b4",  0x0c0000, 0x20000, 0x41b6068b )
  8318.     ROM_LOAD( "ww.b8",  0x0e0000, 0x20000, 0x97eac164 )
  8319.     ROM_LOAD( "ww.a1",  0x100000, 0x20000, 0x260311c5 )
  8320.     ROM_LOAD( "ww.b10", 0x120000, 0x20000, 0x35a4b1b1 )
  8321.     ROM_LOAD( "ww.a2",  0x140000, 0x10000, 0x12e38a5c )
  8322.     ROM_LOAD( "ww.b11", 0x160000, 0x10000, 0xfa06fd24 )
  8323.  
  8324.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  8325.     ROM_LOAD( "ww.a10", 0x0000, 0x08000, 0xc3609607 )
  8326.     ROM_LOAD( "ww.a11", 0x10000, 0x20000, 0xfb9a7f29 )
  8327.     ROM_LOAD( "ww.a12", 0x30000, 0x20000, 0xd6617b19 )
  8328. ROM_END
  8329.  
  8330. /***************************************************************************/
  8331.  
  8332. static READ_HANDLER( ww_io_service_r )
  8333. {
  8334.     return io_service_r(offset) | (READ_WORD(&sys16_workingram[0x2082]) & 0xff00);
  8335. }
  8336.  
  8337. static struct MemoryReadAddress wrestwar_readmem[] =
  8338. {
  8339.  
  8340.     { 0x000000, 0x0bffff, MRA_ROM },
  8341.     { 0x100000, 0x10ffff, MRA_TILERAM },
  8342.     { 0x110000, 0x110fff, MRA_TEXTRAM },
  8343.     { 0x200000, 0x200fff, MRA_SPRITERAM },
  8344.     { 0x300000, 0x300fff, MRA_PALETTERAM },
  8345.     { 0x400000, 0x400003, MRA_EXTRAM },
  8346.     { 0xc40000, 0xc40001, MRA_EXTRAM2 },
  8347.     { 0xc41002, 0xc41003, io_player1_r },
  8348.     { 0xc41006, 0xc41007, io_player2_r },
  8349.     { 0xc42002, 0xc42003, io_dip1_r },
  8350.     { 0xc42000, 0xc42001, io_dip2_r },
  8351.     { 0xffe082, 0xffe083, ww_io_service_r },
  8352.     { 0xffc000, 0xffffff, MRA_WORKINGRAM },
  8353.     {-1}
  8354. };
  8355.  
  8356. static struct MemoryWriteAddress wrestwar_writemem[] =
  8357. {
  8358.     { 0x000000, 0x0bffff, MWA_ROM },
  8359.     { 0x100000, 0x10ffff, MWA_TILERAM },
  8360.     { 0x110000, 0x110fff, MWA_TEXTRAM },
  8361.     { 0x200000, 0x200fff, MWA_SPRITERAM },
  8362.     { 0x300000, 0x300fff, MWA_PALETTERAM },
  8363.     { 0x400000, 0x400003, MWA_EXTRAM },
  8364.     { 0xc40000, 0xc40001, MWA_EXTRAM2 },
  8365.     { 0xc43034, 0xc43035, MWA_NOP },
  8366.     { 0xffe08e, 0xffe08f, sound_command_w },
  8367.     { 0xffc000, 0xffffff, MWA_WORKINGRAM },
  8368.     {-1}
  8369. };
  8370. /***************************************************************************/
  8371.  
  8372. static void wrestwar_update_proc( void ){
  8373.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  8374.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  8375.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  8376.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  8377.  
  8378.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  8379.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  8380.     set_tile_bank( READ_WORD( &sys16_extraram[2] ) );
  8381.     set_refresh( READ_WORD( &sys16_extraram2[0] ) );
  8382. }
  8383.  
  8384. static void wrestwar_init_machine( void ){
  8385.     static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
  8386.  
  8387.     sys16_obj_bank = bank;
  8388.     sys16_bg_priority_mode=2;
  8389.     sys16_bg_priority_value=0x0a00;
  8390.  
  8391.     sys16_update_proc = wrestwar_update_proc;
  8392. }
  8393.  
  8394. static void init_wrestwar( void ){
  8395.     sys16_onetime_init_machine();
  8396.     sys16_bg1_trans=1;
  8397.     sys16_MaxShadowColors=16;
  8398.     sys18_splittab_bg_y=&sys16_textram[0x0f40];
  8399.     sys18_splittab_fg_y=&sys16_textram[0x0f00];
  8400.     sys16_rowscroll_scroll=0x8000;
  8401.  
  8402.     sys16_sprite_decode( 6,0x40000 );
  8403. }
  8404. /***************************************************************************/
  8405.  
  8406. INPUT_PORTS_START( wrestwar )
  8407.     SYS16_JOY1
  8408.     SYS16_JOY2
  8409.     SYS16_SERVICE
  8410.     SYS16_COINAGE
  8411.  
  8412. PORT_START    /* DSW1 */
  8413.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  8414.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  8415.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  8416.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  8417.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  8418.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  8419.     PORT_DIPNAME( 0x0c, 0x0c, "Round Time" )
  8420.     PORT_DIPSETTING(    0x00, "100" )
  8421.     PORT_DIPSETTING(    0x0c, "110" )
  8422.     PORT_DIPSETTING(    0x08, "120" )
  8423.     PORT_DIPSETTING(    0x04, "130" )
  8424.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  8425.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  8426.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  8427.     PORT_DIPNAME( 0x20, 0x20, "Continuation" )
  8428.     PORT_DIPSETTING(    0x20, "Continue" )
  8429.     PORT_DIPSETTING(    0x00, "No Continue" )
  8430.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
  8431.     PORT_DIPSETTING(    0x80, "Easy" )
  8432.     PORT_DIPSETTING(    0xc0, "Normal" )
  8433.     PORT_DIPSETTING(    0x40, "Hard" )
  8434.     PORT_DIPSETTING(    0x00, "Hardest" )
  8435.  
  8436. INPUT_PORTS_END
  8437.  
  8438. /***************************************************************************/
  8439.  
  8440. MACHINE_DRIVER_7759( machine_driver_wrestwar, \
  8441.     wrestwar_readmem,wrestwar_writemem,wrestwar_init_machine, gfx2,upd7759_interface )
  8442.  
  8443.  
  8444. /***************************************************************************/
  8445. /***************************************************************************/
  8446.  
  8447. /* hang-on's accel/brake are really both analog controls, but I've added them
  8448. as digital as well to see what works better */
  8449. #define HANGON_DIGITAL_CONTROLS
  8450.  
  8451. // hangon hardware
  8452. ROM_START( hangon )
  8453.     ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
  8454.     ROM_LOAD_EVEN( "6918.rom", 0x000000, 0x8000, 0x20b1c2b0 )
  8455.     ROM_LOAD_ODD ( "6916.rom", 0x000000, 0x8000, 0x7d9db1bf )
  8456.     ROM_LOAD_EVEN( "6917.rom", 0x010000, 0x8000, 0xfea12367 )
  8457.     ROM_LOAD_ODD ( "6915.rom", 0x010000, 0x8000, 0xac883240 )
  8458.  
  8459.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  8460.     ROM_LOAD( "6841.rom", 0x00000, 0x08000, 0x54d295dc )
  8461.     ROM_LOAD( "6842.rom", 0x08000, 0x08000, 0xf677b568 )
  8462.     ROM_LOAD( "6843.rom", 0x10000, 0x08000, 0xa257f0da )
  8463.  
  8464.     ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
  8465.     ROM_LOAD( "6819.rom", 0x000000, 0x008000, 0x469dad07 )
  8466.     ROM_RELOAD(           0x070000, 0x008000 )    /* again? */
  8467.     ROM_LOAD( "6820.rom", 0x008000, 0x008000, 0x87cbc6de )
  8468.     ROM_RELOAD(           0x078000, 0x008000 )    /* again? */
  8469.     ROM_LOAD( "6821.rom", 0x010000, 0x008000, 0x15792969 )
  8470.     ROM_LOAD( "6822.rom", 0x018000, 0x008000, 0xe9718de5 )
  8471.     ROM_LOAD( "6823.rom", 0x020000, 0x008000, 0x49422691 )
  8472.     ROM_LOAD( "6824.rom", 0x028000, 0x008000, 0x701deaa4 )
  8473.     ROM_LOAD( "6825.rom", 0x030000, 0x008000, 0x6e23c8b4 )
  8474.     ROM_LOAD( "6826.rom", 0x038000, 0x008000, 0x77d0de2c )
  8475.     ROM_LOAD( "6827.rom", 0x040000, 0x008000, 0x7fa1bfb6 )
  8476.     ROM_LOAD( "6828.rom", 0x048000, 0x008000, 0x8e880c93 )
  8477.     ROM_LOAD( "6829.rom", 0x050000, 0x008000, 0x7ca0952d )
  8478.     ROM_LOAD( "6830.rom", 0x058000, 0x008000, 0xb1a63aef )
  8479.     ROM_LOAD( "6845.rom", 0x060000, 0x008000, 0xba08c9b8 )
  8480.     ROM_LOAD( "6846.rom", 0x068000, 0x008000, 0xf21e57a3 )
  8481.  
  8482.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  8483.     ROM_LOAD( "6833.rom", 0x00000, 0x4000, 0x3b942f5f )
  8484.  
  8485.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* Sega PCM sound data */
  8486.     ROM_LOAD( "6831.rom", 0x00000, 0x8000, 0xcfef5481 )
  8487.     ROM_LOAD( "6832.rom", 0x08000, 0x8000, 0x4165aea5 )
  8488.  
  8489.     ROM_REGION( 0x10000, REGION_CPU3 ) /* second 68000 CPU */
  8490.     ROM_LOAD_EVEN("6920.rom", 0x0000, 0x8000, 0x1c95013e )
  8491.     ROM_LOAD_ODD( "6919.rom", 0x0000, 0x8000, 0x6ca30d69 )
  8492.  
  8493.     ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
  8494.     ROM_LOAD( "6840.rom", 0x0000, 0x8000, 0x581230e3 )
  8495. ROM_END
  8496.  
  8497. /***************************************************************************/
  8498.  
  8499.  
  8500. static READ_HANDLER( ho_io_x_r ){ return input_port_0_r( offset ); }
  8501. #ifdef HANGON_DIGITAL_CONTROLS
  8502. static READ_HANDLER( ho_io_y_r ){
  8503.     int data = input_port_1_r( offset );
  8504.  
  8505.     switch(data & 3)
  8506.     {
  8507.         case 3:    return 0xffff;    // both
  8508.         case 2:    return 0x00ff;  // brake
  8509.         case 1:    return 0xff00;  // accel
  8510.         case 0:    return 0x0000;  // neither
  8511.     }
  8512.     return 0x0000;
  8513. }
  8514. #else
  8515. static READ_HANDLER( ho_io_y_r ){ return (input_port_1_r( offset ) << 8) + input_port_5_r( offset ); }
  8516. #endif
  8517.  
  8518. static READ_HANDLER( ho_io_highscoreentry_r )
  8519. {
  8520.     int mode=READ_WORD(&sys16_extraram4[0x3000]);
  8521.  
  8522.     if(mode&4)
  8523.     {    // brake
  8524.         if(ho_io_y_r(0) & 0x00ff) return 0xffff;
  8525.     }
  8526.     else if(mode&8)
  8527.     {
  8528.         // button
  8529.         if(ho_io_y_r(0) & 0xff00) return 0xffff;
  8530.     }
  8531.     return 0;
  8532. }
  8533.  
  8534. static READ_HANDLER( hangon1_skip_r )
  8535. {
  8536.     if (cpu_get_pc()==0x17e6) {cpu_spinuntil_int(); return 0xffff;}
  8537.  
  8538. //    return READ_WORD(&sys16_extraram[0xc400]);
  8539.     return READ_WORD(&sys16_extraram[0x0400]);
  8540. }
  8541.  
  8542.  
  8543. static struct MemoryReadAddress hangon_readmem[] =
  8544. {
  8545.     { 0x000000, 0x03ffff, MRA_ROM },
  8546.     { 0x20c400, 0x20c401, hangon1_skip_r },
  8547.     { 0x20c000, 0x20ffff, MRA_EXTRAM },
  8548.     { 0x400000, 0x40ffff, MRA_TILERAM },
  8549.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  8550.     { 0x600000, 0x600fff, MRA_SPRITERAM },
  8551.     { 0xa00000, 0xa00fff, MRA_PALETTERAM },
  8552.     { 0xc68000, 0xc68fff, MRA_EXTRAM2 },
  8553.     { 0xc7e000, 0xc7ffff, MRA_EXTRAM3 },
  8554.     { 0xe01000, 0xe01001, io_service_r },
  8555.     { 0xe0100c, 0xe0100d, io_dip2_r },
  8556.     { 0xe0100a, 0xe0100b, io_dip1_r },
  8557.     { 0xe03020, 0xe03021, ho_io_highscoreentry_r },
  8558.     { 0xe03028, 0xe03029, ho_io_x_r },
  8559.     { 0xe0302a, 0xe0302b, ho_io_y_r },
  8560.     { 0xe00000, 0xe03fff, MRA_EXTRAM4 },
  8561.     {-1}
  8562. };
  8563.  
  8564. static struct MemoryWriteAddress hangon_writemem[] =
  8565. {
  8566.     { 0x000000, 0x03ffff, MWA_ROM },
  8567.     { 0x20c000, 0x20ffff, MWA_EXTRAM },
  8568.     { 0x400000, 0x40ffff, MWA_TILERAM },
  8569.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  8570.     { 0x600000, 0x600fff, MWA_SPRITERAM },
  8571.     { 0xa00000, 0xa00fff, MWA_PALETTERAM },
  8572.     { 0xc68000, 0xc68fff, MWA_EXTRAM2 },
  8573.     { 0xc7e000, 0xc7ffff, MWA_EXTRAM3 },
  8574.     { 0xe00000, 0xe00001, sound_command_nmi_w },
  8575.     { 0xe00000, 0xe03fff, MWA_EXTRAM4 },
  8576.     {-1}
  8577. };
  8578.  
  8579. static READ_HANDLER( hangon2_skip_r )
  8580. {
  8581.     if (cpu_get_pc()==0xf66) {cpu_spinuntil_int(); return 0xffff;}
  8582.  
  8583. //    return READ_WORD(&sys16_extraram2[0x3f000]);
  8584.     return READ_WORD(&sys16_extraram3[0x01000]);
  8585. }
  8586.  
  8587. static struct MemoryReadAddress hangon_readmem2[] =
  8588. {
  8589.     { 0x000000, 0x03ffff, MRA_ROM },
  8590.     { 0xc7f000, 0xc7f001, hangon2_skip_r },
  8591.     { 0xc68000, 0xc68fff, MRA_EXTRAM2 },
  8592.     { 0xc7e000, 0xc7ffff, MRA_EXTRAM3 },
  8593.     {-1}
  8594. };
  8595.  
  8596. static struct MemoryWriteAddress hangon_writemem2[] =
  8597. {
  8598.     { 0x000000, 0x03ffff, MWA_ROM },
  8599.     { 0xc68000, 0xc68fff, MWA_EXTRAM2 },
  8600.     { 0xc7e000, 0xc7ffff, MWA_EXTRAM3 },
  8601.     {-1}
  8602. };
  8603.  
  8604.  
  8605. static struct MemoryReadAddress hangon_sound_readmem[] =
  8606. {
  8607.     { 0x0000, 0x7fff, MRA_ROM },
  8608.     { 0xc000, 0xc7ff, MRA_RAM },
  8609.     { 0xd000, 0xd000, YM2203_status_port_0_r },
  8610.     { 0xe000, 0xe7ff, SegaPCM_r },
  8611.     { 0xf800, 0xffff, MRA_RAM },
  8612.     { -1 }  /* end of table */
  8613. };
  8614.  
  8615. static struct MemoryWriteAddress hangon_sound_writemem[] =
  8616. {
  8617.     { 0x0000, 0x7fff, MWA_ROM },
  8618.     { 0xc000, 0xc7ff, MWA_RAM },
  8619.     { 0xd000, 0xd000, YM2203_control_port_0_w },
  8620.     { 0xd001, 0xd001, YM2203_write_port_0_w },
  8621.     { 0xe000, 0xe7ff, SegaPCM_w },
  8622.     { 0xf800, 0xffff, MWA_RAM },
  8623.     { -1 }  /* end of table */
  8624. };
  8625.  
  8626. static struct IOReadPort hangon_sound_readport[] =
  8627. {
  8628.     { 0x40, 0x40, soundlatch_r },
  8629.     { -1 }    /* end of table */
  8630. };
  8631.  
  8632.  
  8633. static struct IOWritePort hangon_sound_writeport[] =
  8634. {
  8635.     { -1 }
  8636. };
  8637.  
  8638. /***************************************************************************/
  8639.  
  8640. static void hangon_update_proc( void ){
  8641.     int leds;
  8642.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
  8643.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
  8644.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
  8645.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
  8646.  
  8647.     set_fg_page1( READ_WORD( &sys16_textram[0x0e9e] ) );
  8648.     set_bg_page1( READ_WORD( &sys16_textram[0x0e9c] ) );
  8649.     set_refresh_3d( READ_WORD( &sys16_extraram4[0x2] ) );
  8650.  
  8651.     leds=READ_WORD( &sys16_extraram4[0x2] );
  8652.     if(leds & 4)
  8653.     {
  8654.         osd_led_w(0,1);
  8655.         osd_led_w(1,1);
  8656.         osd_led_w(2,1);
  8657.     }
  8658.     else
  8659.     {
  8660.         osd_led_w(0,0);
  8661.         osd_led_w(1,0);
  8662.         osd_led_w(2,0);
  8663.     }
  8664.  
  8665. }
  8666.  
  8667. static void hangon_init_machine( void ){
  8668.     static int bank[16] = { 00,01,02,03,04,05,06,00,01,02,03,04,05,06,00,06};
  8669.     sys16_obj_bank = bank;
  8670.     sys16_textmode=1;
  8671.     sys16_spritesystem = 5;
  8672.     sys16_sprxoffset = -0xc0;
  8673.     sys16_fgxoffset = 8;
  8674.     sys16_textlayer_lo_min=0;
  8675.     sys16_textlayer_lo_max=0;
  8676.     sys16_textlayer_hi_min=0;
  8677.     sys16_textlayer_hi_max=0xff;
  8678.  
  8679.     patch_code( 0x83bd, 0x29);
  8680.     patch_code( 0x8495, 0x2a);
  8681.     patch_code( 0x84f9, 0x2b);
  8682.  
  8683.     sys16_update_proc = hangon_update_proc;
  8684.  
  8685.     gr_ver = &sys16_extraram2[0x0];
  8686.     gr_hor = gr_ver+0x200;
  8687.     gr_pal = gr_ver+0x400;
  8688.     gr_flip= gr_ver+0x600;
  8689.     gr_palette= 0xf80 / 2;
  8690.     gr_palette_default = 0x70 /2;
  8691.     gr_colorflip[0][0]=0x08 / 2;
  8692.     gr_colorflip[0][1]=0x04 / 2;
  8693.     gr_colorflip[0][2]=0x00 / 2;
  8694.     gr_colorflip[0][3]=0x06 / 2;
  8695.     gr_colorflip[1][0]=0x0a / 2;
  8696.     gr_colorflip[1][1]=0x04 / 2;
  8697.     gr_colorflip[1][2]=0x02 / 2;
  8698.     gr_colorflip[1][3]=0x02 / 2;
  8699. }
  8700.  
  8701.  
  8702.  
  8703. static void init_hangon( void )
  8704. {
  8705.     sys16_onetime_init_machine();
  8706.  
  8707.     sys16_sprite_decode( 8,0x010000 );
  8708.     generate_gr_screen(512,1024,8,0,4,0x8000);
  8709. }
  8710. /***************************************************************************/
  8711.  
  8712. INPUT_PORTS_START( hangon )
  8713. PORT_START    /* Steering */
  8714.     PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_X | IPF_REVERSE | IPF_CENTER , 100, 3, 0x48, 0xb7 )
  8715.  
  8716. #ifdef HANGON_DIGITAL_CONTROLS
  8717.  
  8718. PORT_START    /* Buttons */
  8719.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  8720.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  8721.  
  8722. #else
  8723.  
  8724. PORT_START    /* Accel / Decel */
  8725.     PORT_ANALOG( 0xff, 0x1, IPT_AD_STICK_Y | IPF_CENTER | IPF_REVERSE, 100, 16, 0, 0xa2 )
  8726.  
  8727. #endif
  8728.  
  8729.     SYS16_SERVICE
  8730.     SYS16_COINAGE
  8731.  
  8732. PORT_START    /* DSW1 */
  8733.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
  8734.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  8735.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  8736.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
  8737.     PORT_DIPSETTING(    0x04, "Easy" )
  8738.     PORT_DIPSETTING(    0x06, "Normal" )
  8739.     PORT_DIPSETTING(    0x02, "Hard" )
  8740.     PORT_DIPSETTING(    0x00, "Hardest" )
  8741.     PORT_DIPNAME( 0x18, 0x18, "Time Adj." )
  8742.     PORT_DIPSETTING(    0x18, "Normal" )
  8743.     PORT_DIPSETTING(    0x10, "Medium" )
  8744.     PORT_DIPSETTING(    0x08, "Hard" )
  8745.     PORT_DIPSETTING(    0x00, "Hardest" )
  8746.     PORT_DIPNAME( 0x20, 0x20, "Play Music" )
  8747.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  8748.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  8749.  
  8750. #ifndef HANGON_DIGITAL_CONTROLS
  8751.  
  8752. PORT_START    /* Brake */
  8753.     PORT_ANALOG( 0xff, 0x1, IPT_AD_STICK_Y | IPF_PLAYER2 | IPF_CENTER | IPF_REVERSE, 100, 16, 0, 0xa2 )
  8754.  
  8755. #endif
  8756. INPUT_PORTS_END
  8757.  
  8758. /***************************************************************************/
  8759.  
  8760. static struct MachineDriver machine_driver_hangon =
  8761. {
  8762.     {
  8763.         {
  8764.             CPU_M68000,
  8765.             10000000,
  8766.             hangon_readmem,hangon_writemem,0,0,
  8767.             sys16_interrupt,1
  8768.         },
  8769.         {
  8770.             CPU_Z80 | CPU_AUDIO_CPU,
  8771.             4096000,
  8772.             hangon_sound_readmem,hangon_sound_writemem,hangon_sound_readport,hangon_sound_writeport,
  8773. //            ignore_interrupt,1
  8774.             interrupt,4
  8775.         },
  8776.         {
  8777.             CPU_M68000,
  8778.             10000000,
  8779.             hangon_readmem2,hangon_writemem2,0,0,
  8780.             sys16_interrupt,1
  8781.         },
  8782.     },
  8783.     60, DEFAULT_60HZ_VBLANK_DURATION,
  8784.     1,
  8785.     hangon_init_machine,
  8786.     40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
  8787.     gfx8,
  8788.     2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
  8789.     0,
  8790.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  8791.     0,
  8792.     sys16_ho_vh_start,
  8793.     sys16_vh_stop,
  8794.     sys16_ho_vh_screenrefresh,
  8795.     SOUND_SUPPORTS_STEREO,0,0,0,
  8796.     {
  8797.         {
  8798.             SOUND_YM2203,
  8799.             &ym2203_interface
  8800.         },
  8801.         {            // wrong sound chip??
  8802.             SOUND_SEGAPCM,
  8803.             &segapcm_interface_32k,
  8804.         }
  8805.     }
  8806. };
  8807.  
  8808.  
  8809. /***************************************************************************/
  8810. // space harrier / enduro racer hardware
  8811. ROM_START( sharrier )
  8812.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  8813.     ROM_LOAD_EVEN( "ic97.bin", 0x000000, 0x8000, 0x7c30a036 )
  8814.     ROM_LOAD_ODD ( "ic84.bin", 0x000000, 0x8000, 0x16deaeb1 )
  8815.     ROM_LOAD_EVEN( "ic98.bin", 0x010000, 0x8000, 0x40b1309f )
  8816.     ROM_LOAD_ODD ( "ic85.bin", 0x010000, 0x8000, 0xce78045c )
  8817.     ROM_LOAD_EVEN( "ic99.bin", 0x020000, 0x8000, 0xf6391091 )
  8818.     ROM_LOAD_ODD ( "ic86.bin", 0x020000, 0x8000, 0x79b367d7 )
  8819.     ROM_LOAD_EVEN( "ic100.bin", 0x030000, 0x8000, 0x6171e9d3 )
  8820.     ROM_LOAD_ODD ( "ic87.bin", 0x030000, 0x8000, 0x70cb72ef )
  8821.  
  8822.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  8823.     ROM_LOAD( "sic31.bin", 0x00000, 0x08000, 0x347fa325 )
  8824.     ROM_LOAD( "sic46.bin", 0x08000, 0x08000, 0x39d98bd1 )
  8825.     ROM_LOAD( "sic60.bin", 0x10000, 0x08000, 0x3da3ea6b )
  8826.  
  8827.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  8828.     ROM_LOAD( "ic36.bin", 0x000000, 0x008000, 0x93e2d264 )
  8829.     ROM_LOAD( "ic28.bin", 0x008000, 0x008000, 0xedbf5fc3 )
  8830.     ROM_LOAD( "ic118.bin",0x010000, 0x008000, 0xe8c537d8 )
  8831.     ROM_LOAD( "ic8.bin",  0x018000, 0x008000, 0x22844fa4 )
  8832.  
  8833.     ROM_LOAD( "ic35.bin", 0x020000, 0x008000, 0xcd6e7500 )
  8834.     ROM_LOAD( "ic27.bin", 0x028000, 0x008000, 0x41f25a9c )
  8835.     ROM_LOAD( "ic17.bin", 0x030000, 0x008000, 0x5bb09a67 )
  8836.     ROM_LOAD( "ic7.bin",  0x038000, 0x008000, 0xdcaa2ebf )
  8837.  
  8838.     ROM_LOAD( "ic34.bin", 0x040000, 0x008000, 0xd5e15e66 )
  8839.     ROM_LOAD( "ic26.bin", 0x048000, 0x008000, 0xac62ae2e )
  8840.     ROM_LOAD( "ic16.bin", 0x050000, 0x008000, 0x9c782295 )
  8841.     ROM_LOAD( "ic6.bin",  0x058000, 0x008000, 0x3711105c )
  8842.  
  8843.     ROM_LOAD( "ic33.bin", 0x060000, 0x008000, 0x60d7c1bb )
  8844.     ROM_LOAD( "ic25.bin", 0x068000, 0x008000, 0xf6330038 )
  8845.     ROM_LOAD( "ic15.bin", 0x070000, 0x008000, 0x60737b98 )
  8846.     ROM_LOAD( "ic5.bin",  0x078000, 0x008000, 0x70fb5ebb )
  8847.  
  8848.     ROM_LOAD( "ic32.bin", 0x080000, 0x008000, 0x6d7b5c97 )
  8849.     ROM_LOAD( "ic24.bin", 0x088000, 0x008000, 0xcebf797c )
  8850.     ROM_LOAD( "ic14.bin", 0x090000, 0x008000, 0x24596a8b )
  8851.     ROM_LOAD( "ic4.bin",  0x098000, 0x008000, 0xb537d082 )
  8852.  
  8853.     ROM_LOAD( "ic31.bin", 0x0a0000, 0x008000, 0x5e784271 )
  8854.     ROM_LOAD( "ic23.bin", 0x0a8000, 0x008000, 0x510e5e10 )
  8855.     ROM_LOAD( "ic13.bin", 0x0b0000, 0x008000, 0x7a2dad15 )
  8856.     ROM_LOAD( "ic3.bin",  0x0b8000, 0x008000, 0xf5ba4e08 )
  8857.  
  8858.     ROM_LOAD( "ic30.bin", 0x0c0000, 0x008000, 0xec42c9ef )
  8859.     ROM_LOAD( "ic22.bin", 0x0c8000, 0x008000, 0x6d4a7d7a )
  8860.     ROM_LOAD( "ic12.bin", 0x0d0000, 0x008000, 0x0f732717 )
  8861.     ROM_LOAD( "ic2.bin",  0x0d8000, 0x008000, 0xfc3bf8f3 )
  8862.  
  8863.     ROM_LOAD( "ic29.bin", 0x0e0000, 0x008000, 0xed51fdc4 )
  8864.     ROM_LOAD( "ic21.bin", 0x0e8000, 0x008000, 0xdfe75f3d )
  8865.     ROM_LOAD( "ic11.bin", 0x0f0000, 0x008000, 0xa2c07741 )
  8866.     ROM_LOAD( "ic1.bin",  0x0f8000, 0x008000, 0xb191e22f )
  8867.  
  8868.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  8869.     ROM_LOAD( "ic73.bin", 0x00000, 0x004000, 0xd6397933 )
  8870.     ROM_LOAD( "ic72.bin", 0x04000, 0x004000, 0x504e76d9 )
  8871.  
  8872.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* Sega PCM sound data */
  8873.     ROM_LOAD( "snd7231.256", 0x00000, 0x008000, 0x871c6b14 )
  8874.     ROM_LOAD( "snd7232.256", 0x08000, 0x008000, 0x4b59340c )
  8875.  
  8876.     ROM_REGION( 0x10000, REGION_CPU3 ) /* second 68000 CPU */
  8877.     ROM_LOAD_EVEN("ic54.bin", 0x0000, 0x8000, 0xd7c535b6 )
  8878.     ROM_LOAD_ODD( "ic67.bin", 0x0000, 0x8000, 0xa6153af8 )
  8879.  
  8880.     ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
  8881.     ROM_LOAD( "pic2.bin", 0x0000, 0x8000, 0xb4740419 )
  8882. ROM_END
  8883.  
  8884. /***************************************************************************/
  8885.  
  8886. static READ_HANDLER( sh_io_joy_r ){ return (input_port_5_r( offset ) << 8) + input_port_6_r( offset ); }
  8887.  
  8888. static unsigned char *shared_ram;
  8889. static READ_HANDLER( shared_ram_r ) { return READ_WORD(&shared_ram[offset]); }
  8890. static WRITE_HANDLER( shared_ram_w ) { COMBINE_WORD_MEM(&shared_ram[offset], data); }
  8891.  
  8892. static READ_HANDLER( sh_motor_status_r ) { return 0x0; }
  8893.  
  8894. static struct MemoryReadAddress harrier_readmem[] =
  8895. {
  8896.     { 0x000000, 0x03ffff, MRA_ROM },
  8897.     { 0x040000, 0x043fff, MRA_EXTRAM },
  8898.     { 0x100000, 0x107fff, MRA_TILERAM },
  8899.     { 0x108000, 0x108fff, MRA_TEXTRAM },
  8900.     { 0x110000, 0x110fff, MRA_PALETTERAM },
  8901.     { 0x124000, 0x127fff, shared_ram_r },
  8902.     { 0x130000, 0x130fff, MRA_SPRITERAM },
  8903.     { 0x140010, 0x140011, io_service_r },
  8904.     { 0x140014, 0x140015, io_dip1_r },
  8905.     { 0x140016, 0x140017, io_dip2_r },
  8906.     { 0x140024, 0x140027, sh_motor_status_r },
  8907.     { 0x140000, 0x140027, MRA_EXTRAM3 },        //io
  8908.     { 0xc68000, 0xc68fff, MRA_EXTRAM2 },
  8909.  
  8910.     {-1}
  8911. };
  8912.  
  8913. static struct MemoryWriteAddress harrier_writemem[] =
  8914. {
  8915.     { 0x000000, 0x03ffff, MWA_ROM },
  8916.     { 0x040000, 0x043fff, MWA_EXTRAM },
  8917.     { 0x100000, 0x107fff, MWA_TILERAM },
  8918.     { 0x108000, 0x108fff, MWA_TEXTRAM },
  8919.     { 0x110000, 0x110fff, MWA_PALETTERAM },
  8920.     { 0x124000, 0x127fff, shared_ram_w, &shared_ram },
  8921.     { 0x130000, 0x130fff, MWA_SPRITERAM },
  8922.     { 0x140000, 0x140001, sound_command_nmi_w },
  8923.     { 0x140000, 0x140027, MWA_EXTRAM3 },        //io
  8924.     { 0xc68000, 0xc68fff, MWA_EXTRAM2 },
  8925.  
  8926.     {-1}
  8927. };
  8928.  
  8929. static struct MemoryReadAddress harrier_readmem2[] =
  8930. {
  8931.     { 0x000000, 0x03ffff, MRA_ROM },
  8932.     { 0xc68000, 0xc68fff, MRA_EXTRAM2 },
  8933.     { 0xc7c000, 0xc7ffff, shared_ram_r },
  8934.     {-1}
  8935. };
  8936.  
  8937. static struct MemoryWriteAddress harrier_writemem2[] =
  8938. {
  8939.     { 0x000000, 0x03ffff, MWA_ROM },
  8940.     { 0xc68000, 0xc68fff, MWA_EXTRAM2 },
  8941.     { 0xc7c000, 0xc7ffff, shared_ram_w, &shared_ram },
  8942.     {-1}
  8943. };
  8944.  
  8945. static struct MemoryReadAddress harrier_sound_readmem[] =
  8946. {
  8947.     { 0x0000, 0x7fff, MRA_ROM },
  8948.     { 0xd000, 0xd000, YM2203_status_port_0_r },
  8949.     { 0xe000, 0xe0ff, SegaPCM_r },
  8950.     { 0x8000, 0xffff, MRA_RAM },
  8951.     { -1 }  /* end of table */
  8952. };
  8953.  
  8954. static struct MemoryWriteAddress harrier_sound_writemem[] =
  8955. {
  8956.     { 0x0000, 0x7fff, MWA_ROM },
  8957.     { 0xd000, 0xd000, YM2203_control_port_0_w },
  8958.     { 0xd001, 0xd001, YM2203_write_port_0_w },
  8959.     { 0xe000, 0xe0ff, SegaPCM_w },
  8960.     { 0x8000, 0xffff, MWA_RAM },
  8961.     { -1 }  /* end of table */
  8962. };
  8963.  
  8964. static struct IOReadPort harrier_sound_readport[] =
  8965. {
  8966.     { 0x40, 0x40, soundlatch_r },
  8967.     { -1 }    /* end of table */
  8968. };
  8969.  
  8970.  
  8971. static struct IOWritePort harrier_sound_writeport[] =
  8972. {
  8973.     { -1 }
  8974. };
  8975.  
  8976. /***************************************************************************/
  8977.  
  8978. static void harrier_update_proc( void ){
  8979.     int data;
  8980.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
  8981.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
  8982.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x01ff;
  8983.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
  8984.  
  8985.     data = READ_WORD( &sys16_textram[0x0e9e] );
  8986.  
  8987.     sys16_fg_page[0] = data>>12;
  8988.     sys16_fg_page[1] = (data>>8)&0xf;
  8989.     sys16_fg_page[3] = (data>>4)&0xf;
  8990.     sys16_fg_page[2] = data&0xf;
  8991.  
  8992.     data = READ_WORD( &sys16_textram[0x0e9c] );
  8993.     sys16_bg_page[0] = data>>12;
  8994.     sys16_bg_page[1] = (data>>8)&0xf;
  8995.     sys16_bg_page[3] = (data>>4)&0xf;
  8996.     sys16_bg_page[2] = data&0xf;
  8997.  
  8998.     WRITE_WORD(&sys16_extraram[0x492],sh_io_joy_r(0));
  8999.  
  9000.     data=READ_WORD( &sys16_extraram3[2] );
  9001.     set_refresh_3d( data );
  9002.  
  9003.     if(data & 8)
  9004.     {
  9005.         osd_led_w(0,1);
  9006.         osd_led_w(2,1);
  9007.     }
  9008.     else
  9009.     {
  9010.         osd_led_w(0,0);
  9011.         osd_led_w(2,0);
  9012.     }
  9013.     if(data & 4)
  9014.         osd_led_w(1,1);
  9015.     else
  9016.         osd_led_w(1,0);
  9017.  
  9018. }
  9019.  
  9020. static void harrier_init_machine( void ){
  9021.     static int bank[16] = { 00,01,02,03,04,05,06,07,00,00,00,00,00,00,00,00};
  9022.     sys16_obj_bank = bank;
  9023.     sys16_textmode=1;
  9024.     sys16_spritesystem = 6;
  9025.     sys16_sprxoffset = -0xc0;
  9026.     sys16_fgxoffset = 8;
  9027.     sys16_textlayer_lo_min=0;
  9028.     sys16_textlayer_lo_max=0;
  9029.     sys16_textlayer_hi_min=0;
  9030.     sys16_textlayer_hi_max=0xff;
  9031.  
  9032.  
  9033. //*disable illegal rom writes
  9034.     patch_code( 0x8112, 0x4a);
  9035.     patch_code( 0x83d2, 0x4a);
  9036.     patch_code( 0x83d6, 0x4a);
  9037.     patch_code( 0x82c4, 0x4a);
  9038.     patch_code( 0x82c8, 0x4a);
  9039.     patch_code( 0x84d0, 0x4a);
  9040.     patch_code( 0x84d4, 0x4a);
  9041.     patch_code( 0x85de, 0x4a);
  9042.     patch_code( 0x85e2, 0x4a);
  9043.  
  9044.     sys16_update_proc = harrier_update_proc;
  9045.  
  9046.     gr_ver = &sys16_extraram2[0x0];
  9047.     gr_hor = gr_ver+0x200;
  9048.     gr_pal = gr_ver+0x400;
  9049.     gr_flip= gr_ver+0x600;
  9050.     gr_palette= 0xf80 / 2;
  9051.     gr_palette_default = 0x70 /2;
  9052.     gr_colorflip[0][0]=0x00 / 2;
  9053.     gr_colorflip[0][1]=0x02 / 2;
  9054.     gr_colorflip[0][2]=0x04 / 2;
  9055.     gr_colorflip[0][3]=0x00 / 2;
  9056.     gr_colorflip[1][0]=0x00 / 2;
  9057.     gr_colorflip[1][1]=0x00 / 2;
  9058.     gr_colorflip[1][2]=0x06 / 2;
  9059.     gr_colorflip[1][3]=0x00 / 2;
  9060.  
  9061.     sys16_sh_shadowpal=0;
  9062. }
  9063.  
  9064. static void init_sharrier( void )
  9065. {
  9066.     sys16_onetime_init_machine();
  9067.     sys16_MaxShadowColors=NumOfShadowColors / 2;
  9068.  
  9069. #ifdef SPACEHARRIER_OFFSETS
  9070.     spaceharrier_patternoffsets=malloc(65536);
  9071.  
  9072.     memset(spaceharrier_patternoffsets,0x7f,65535);
  9073.     spaceharrier_patternoffsets[0x2124] = 0; // small shadow
  9074.     spaceharrier_patternoffsets[0x2429] = 4; // ice berg of round 7
  9075.     spaceharrier_patternoffsets[0x211b] = 1; // small flying rock
  9076.     spaceharrier_patternoffsets[0x515b] = 0; // small flying ball
  9077.     spaceharrier_patternoffsets[0x611f] = 0; // small ceiling ball
  9078.     spaceharrier_patternoffsets[0x624a] = 1; // small ceiling ball
  9079.     spaceharrier_patternoffsets[0x5785] = 1; // 3 poses of the Harrier on the title screen
  9080.     spaceharrier_patternoffsets[0x5771] = 1; // these are the only patterns which do not need
  9081.     spaceharrier_patternoffsets[0x579a] = 1; // position compensations
  9082.     spaceharrier_patternoffsets[0x06f3] = 0; // missiles
  9083.     spaceharrier_patternoffsets[0x0735] = 0;
  9084. #endif
  9085.  
  9086.     sys16_sprite_decode2( 8,0x020000 ,1);
  9087.     generate_gr_screen(512,512,0,0,4,0x8000);
  9088. }
  9089. /***************************************************************************/
  9090.  
  9091. INPUT_PORTS_START( sharrier )
  9092.     SYS16_JOY1
  9093.     SYS16_JOY2
  9094.  
  9095. PORT_START
  9096.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  9097.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  9098.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  9099.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
  9100.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
  9101.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
  9102.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  9103.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  9104.  
  9105.     SYS16_COINAGE
  9106.  
  9107. PORT_START    /* DSW1 */
  9108.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  9109.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  9110.     PORT_DIPSETTING(    0x01, "Moving" )
  9111.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
  9112.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  9113.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  9114.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  9115.     PORT_DIPSETTING(    0x08, "2" )
  9116.     PORT_DIPSETTING(    0x0c, "3" )
  9117.     PORT_DIPSETTING(    0x04, "4" )
  9118.     PORT_DIPSETTING(    0x00, "5" )
  9119.     PORT_DIPNAME( 0x10, 0x10, "Add Player Score" )
  9120.     PORT_DIPSETTING(    0x10, "5000000" )
  9121.     PORT_DIPSETTING(    0x00, "7000000" )
  9122.     PORT_DIPNAME( 0x20, 0x20, "Trial Time" )
  9123.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  9124.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  9125.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
  9126.     PORT_DIPSETTING(    0x80, "Easy" )
  9127.     PORT_DIPSETTING(    0xc0, "Normal" )
  9128.     PORT_DIPSETTING(    0x40, "Hard" )
  9129.     PORT_DIPSETTING(    0x00, "Hardest" )
  9130.  
  9131.  
  9132. PORT_START    /* X */
  9133.     PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_X |  IPF_REVERSE, 100, 4, 0x20, 0xdf )
  9134.  
  9135. PORT_START    /* Y */
  9136.     PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_Y |  IPF_REVERSE, 100, 4, 0x60, 0x9f )
  9137.  
  9138. INPUT_PORTS_END
  9139.  
  9140. /***************************************************************************/
  9141.  
  9142. static struct MachineDriver machine_driver_sharrier =
  9143. {
  9144.     {
  9145.         {
  9146.             CPU_M68000,
  9147.             10000000,
  9148.             harrier_readmem,harrier_writemem,0,0,
  9149.             sys16_interrupt,1
  9150.         },
  9151.         {
  9152.             CPU_Z80 | CPU_AUDIO_CPU,
  9153.             4096000,
  9154.             harrier_sound_readmem,harrier_sound_writemem,harrier_sound_readport,harrier_sound_writeport,
  9155. //            ignore_interrupt,1
  9156.             interrupt,4
  9157.         },
  9158.         {
  9159.             CPU_M68000,
  9160.             10000000,
  9161.             harrier_readmem2,harrier_writemem2,0,0,
  9162.             sys16_interrupt,1
  9163.         },
  9164.     },
  9165.     60, DEFAULT_60HZ_VBLANK_DURATION,
  9166.     1,
  9167.     harrier_init_machine,
  9168.     40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
  9169.     gfx8,
  9170.     2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
  9171.     0,
  9172.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  9173.     0,
  9174.     sys16_ho_vh_start,
  9175.     sys16_vh_stop,
  9176.     sys16_ho_vh_screenrefresh,
  9177.     SOUND_SUPPORTS_STEREO,0,0,0,
  9178.     {
  9179.         {
  9180.             SOUND_YM2203,
  9181.             &ym2203_interface
  9182.         },
  9183.         {
  9184.             SOUND_SEGAPCM,
  9185.             &segapcm_interface_32k,
  9186.         }
  9187.     }
  9188. };
  9189.  
  9190. /***************************************************************************/
  9191.  
  9192. /* hang-on's accel/brake are really both analog controls, but I've added them
  9193. as digital as well to see what works better */
  9194.  
  9195. // hangon hardware
  9196. ROM_START( shangon )
  9197.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code - protected */
  9198.     ROM_LOAD_EVEN( "ic133", 0x000000, 0x10000, 0xe52721fe )
  9199.     ROM_LOAD_ODD ( "ic118", 0x000000, 0x10000, 0x5fee09f6 )
  9200.     ROM_LOAD_EVEN( "ic132", 0x020000, 0x10000, 0x5d55d65f )
  9201.     ROM_LOAD_ODD ( "ic117", 0x020000, 0x10000, 0xb967e8c3 )
  9202.  
  9203.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  9204.     ROM_LOAD( "ic54",        0x00000, 0x08000, 0x260286f9 )
  9205.     ROM_LOAD( "ic55",        0x08000, 0x08000, 0xc609ee7b )
  9206.     ROM_LOAD( "ic56",        0x10000, 0x08000, 0xb236a403 )
  9207.  
  9208.     ROM_REGION( 0x0120000*2, REGION_GFX2 ) /* sprites */
  9209.     ROM_LOAD( "ic8",         0x000000, 0x010000, 0xd6ac012b )
  9210.     ROM_RELOAD(              0x100000, 0x010000 )    // twice?
  9211.     ROM_LOAD( "ic16",        0x010000, 0x010000, 0xd9d83250 )
  9212.     ROM_RELOAD(              0x110000, 0x010000 )    // twice?
  9213.     ROM_LOAD( "ic7",         0x020000, 0x010000, 0x25ebf2c5 )
  9214.     ROM_RELOAD(              0x0e0000, 0x010000 )    // twice?
  9215.     ROM_LOAD( "ic15",        0x030000, 0x010000, 0x6365d2e9 )
  9216.     ROM_RELOAD(              0x0f0000, 0x010000 )    // twice?
  9217.     ROM_LOAD( "ic6",         0x040000, 0x010000, 0x8a57b8d6 )
  9218.     ROM_LOAD( "ic14",        0x050000, 0x010000, 0x3aff8910 )
  9219.     ROM_LOAD( "ic5",         0x060000, 0x010000, 0xaf473098 )
  9220.     ROM_LOAD( "ic13",        0x070000, 0x010000, 0x80bafeef )
  9221.     ROM_LOAD( "ic4",         0x080000, 0x010000, 0x03bc4878 )
  9222.     ROM_LOAD( "ic12",        0x090000, 0x010000, 0x274b734e )
  9223.     ROM_LOAD( "ic3",         0x0a0000, 0x010000, 0x9f0677ed )
  9224.     ROM_LOAD( "ic11",        0x0b0000, 0x010000, 0x508a4701 )
  9225.     ROM_LOAD( "ic2",         0x0c0000, 0x010000, 0xb176ea72 )
  9226.     ROM_LOAD( "ic10",        0x0d0000, 0x010000, 0x42fcd51d )
  9227.  
  9228.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  9229.     ROM_LOAD( "ic88", 0x0000, 0x08000, 0x1254efa6 )
  9230.  
  9231.     ROM_LOAD( "ic66", 0x10000, 0x08000, 0x06f55364 )
  9232.     ROM_LOAD( "ic67", 0x18000, 0x08000, 0x731f5cf8 )
  9233.     ROM_LOAD( "ic68", 0x20000, 0x08000, 0xa60dabff )
  9234.     ROM_LOAD( "ic69", 0x28000, 0x08000, 0x473cc411 )
  9235.  
  9236.     ROM_REGION( 0x40000, REGION_CPU3 ) /* second 68000 CPU  - protected */
  9237.     ROM_LOAD_EVEN( "ic76", 0x0000, 0x10000, 0x02be68db )
  9238.     ROM_LOAD_ODD ( "ic58", 0x0000, 0x10000, 0xf13e8bee )
  9239.     ROM_LOAD_EVEN( "ic75", 0x20000, 0x10000, 0x1627c224 )
  9240.     ROM_LOAD_ODD ( "ic57", 0x20000, 0x10000, 0x8cdbcde8 )
  9241.  
  9242.     ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
  9243.     ROM_LOAD( "ic47", 0x0000, 0x8000, 0x7836bcc3 )
  9244. ROM_END
  9245.  
  9246. ROM_START( shangonb )
  9247.     ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
  9248.     ROM_LOAD_EVEN( "s-hangon.30", 0x000000, 0x10000, 0xd95e82fc )
  9249.     ROM_LOAD_ODD ( "s-hangon.32", 0x000000, 0x10000, 0x2ee4b4fb )
  9250.     ROM_LOAD_EVEN( "s-hangon.29", 0x020000, 0x8000, 0x12ee8716 )
  9251.     ROM_LOAD_ODD ( "s-hangon.31", 0x020000, 0x8000, 0x155e0cfd )
  9252.  
  9253.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  9254.     ROM_LOAD( "ic54",        0x00000, 0x08000, 0x260286f9 )
  9255.     ROM_LOAD( "ic55",        0x08000, 0x08000, 0xc609ee7b )
  9256.     ROM_LOAD( "ic56",        0x10000, 0x08000, 0xb236a403 )
  9257.  
  9258.     ROM_REGION( 0x0120000*2, REGION_GFX2 ) /* sprites */
  9259.     ROM_LOAD( "ic8",         0x000000, 0x010000, 0xd6ac012b )
  9260.     ROM_RELOAD(              0x100000, 0x010000 )    // twice?
  9261.     ROM_LOAD( "ic16",        0x010000, 0x010000, 0xd9d83250 )
  9262.     ROM_RELOAD(              0x110000, 0x010000 )    // twice?
  9263.     ROM_LOAD( "s-hangon.20", 0x020000, 0x010000, 0xeef23b3d )
  9264.     ROM_RELOAD(              0x0e0000, 0x010000 )    // twice?
  9265.     ROM_LOAD( "s-hangon.14", 0x030000, 0x010000, 0x0f26d131 )
  9266.     ROM_RELOAD(              0x0f0000, 0x010000 )    // twice?
  9267.     ROM_LOAD( "ic6",         0x040000, 0x010000, 0x8a57b8d6 )
  9268.     ROM_LOAD( "ic14",        0x050000, 0x010000, 0x3aff8910 )
  9269.     ROM_LOAD( "ic5",         0x060000, 0x010000, 0xaf473098 )
  9270.     ROM_LOAD( "ic13",        0x070000, 0x010000, 0x80bafeef )
  9271.     ROM_LOAD( "ic4",         0x080000, 0x010000, 0x03bc4878 )
  9272.     ROM_LOAD( "ic12",        0x090000, 0x010000, 0x274b734e )
  9273.     ROM_LOAD( "ic3",         0x0a0000, 0x010000, 0x9f0677ed )
  9274.     ROM_LOAD( "ic11",        0x0b0000, 0x010000, 0x508a4701 )
  9275.     ROM_LOAD( "ic2",         0x0c0000, 0x010000, 0xb176ea72 )
  9276.     ROM_LOAD( "ic10",        0x0d0000, 0x010000, 0x42fcd51d )
  9277.  
  9278.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  9279.     ROM_LOAD( "s-hangon.03", 0x0000, 0x08000, 0x83347dc0 )
  9280.  
  9281.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* Sega PCM sound data */
  9282.     ROM_LOAD( "s-hangon.02", 0x00000, 0x10000, 0xda08ca2b )
  9283.     ROM_LOAD( "s-hangon.01", 0x10000, 0x10000, 0x8b10e601 )
  9284.  
  9285.     ROM_REGION( 0x40000, REGION_CPU3 ) /* second 68000 CPU */
  9286.     ROM_LOAD_EVEN("s-hangon.09", 0x0000, 0x10000, 0x070c8059 )
  9287.     ROM_LOAD_ODD( "s-hangon.05", 0x0000, 0x10000, 0x9916c54b )
  9288.     ROM_LOAD_EVEN("s-hangon.08", 0x20000, 0x10000, 0x000ad595 )
  9289.     ROM_LOAD_ODD( "s-hangon.04", 0x20000, 0x10000, 0x8f8f4af0 )
  9290.  
  9291.     ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
  9292.     ROM_LOAD( "s-hangon.26", 0x0000, 0x8000, 0x1bbe4fc8 )
  9293. ROM_END
  9294.  
  9295.  
  9296. /***************************************************************************/
  9297.  
  9298. static unsigned char *shared_ram2;
  9299. static READ_HANDLER( shared_ram2_r ) { return READ_WORD(&shared_ram2[offset]); }
  9300. static WRITE_HANDLER( shared_ram2_w ) { COMBINE_WORD_MEM(&shared_ram2[offset], data); }
  9301.  
  9302. static struct MemoryReadAddress shangon_readmem[] =
  9303. {
  9304.     { 0x000000, 0x03ffff, MRA_ROM },
  9305.     { 0x20c640, 0x20c647, sound_shared_ram_r },
  9306.     { 0x20c000, 0x20ffff, MRA_EXTRAM5 },
  9307.  
  9308.     { 0x400000, 0x40ffff, MRA_TILERAM },
  9309.     { 0x410000, 0x410fff, MRA_TEXTRAM },
  9310.     { 0x600000, 0x600fff, MRA_SPRITERAM },
  9311.     { 0xa00000, 0xa00fff, MRA_PALETTERAM },
  9312.     { 0xc68000, 0xc68fff, shared_ram_r },
  9313.     { 0xc7c000, 0xc7ffff, shared_ram2_r },
  9314.     { 0xe01000, 0xe01001, io_service_r },
  9315.     { 0xe0100c, 0xe0100d, io_dip2_r },
  9316.     { 0xe0100a, 0xe0100b, io_dip1_r },
  9317.     { 0xe030f8, 0xe030f9, ho_io_x_r },
  9318.     { 0xe030fa, 0xe030fb, ho_io_y_r },
  9319.     { 0xe00000, 0xe03fff, MRA_EXTRAM4 },    // io
  9320.     {-1}
  9321. };
  9322.  
  9323. static struct MemoryWriteAddress shangon_writemem[] =
  9324. {
  9325.     { 0x000000, 0x03ffff, MWA_ROM },
  9326.     { 0x20c640, 0x20c647, sound_shared_ram_w },
  9327.     { 0x20c000, 0x20ffff, MWA_EXTRAM5 },
  9328.     { 0x400000, 0x40ffff, MWA_TILERAM },
  9329.     { 0x410000, 0x410fff, MWA_TEXTRAM },
  9330.     { 0x600000, 0x600fff, MWA_SPRITERAM },
  9331.     { 0xa00000, 0xa00fff, MWA_PALETTERAM },
  9332.     { 0xc68000, 0xc68fff, shared_ram_w, &shared_ram },
  9333.     { 0xc7c000, 0xc7ffff, shared_ram2_w, &shared_ram2 },
  9334.     { 0xe00000, 0xe03fff, MWA_EXTRAM4 },    // io
  9335.     {-1}
  9336. };
  9337.  
  9338. static struct MemoryReadAddress shangon_readmem2[] =
  9339. {
  9340.     { 0x000000, 0x03ffff, MRA_ROM },
  9341.     { 0x454000, 0x45401f, MRA_EXTRAM3 },
  9342.     { 0x7e8000, 0x7e8fff, shared_ram_r },
  9343.     { 0x7fc000, 0x7ffbff, shared_ram2_r },
  9344.     { 0x7ffc00, 0x7fffff, MRA_EXTRAM },
  9345.     {-1}
  9346. };
  9347.  
  9348. static struct MemoryWriteAddress shangon_writemem2[] =
  9349. {
  9350.     { 0x000000, 0x03ffff, MWA_ROM },
  9351.     { 0x454000, 0x45401f, MWA_EXTRAM3 },
  9352.     { 0x7e8000, 0x7e8fff, shared_ram_w },
  9353.     { 0x7fc000, 0x7ffbff, shared_ram2_w },
  9354.     { 0x7ffc00, 0x7fffff, MWA_EXTRAM },
  9355.     {-1}
  9356. };
  9357.  
  9358. static struct MemoryReadAddress shangon_sound_readmem[] =
  9359. {
  9360.     { 0x0000, 0x7fff, MRA_ROM },
  9361.     { 0xf000, 0xf7ff, SegaPCM_r },
  9362.     { 0xf800, 0xf807, sound2_shared_ram_r },
  9363.     { 0xf808, 0xffff, MRA_RAM },
  9364.     { -1 }  /* end of table */
  9365. };
  9366.  
  9367. static struct MemoryWriteAddress shangon_sound_writemem[] =
  9368. {
  9369.     { 0x0000, 0x7fff, MWA_ROM },
  9370.     { 0xf000, 0xf7ff, SegaPCM_w },
  9371.     { 0xf800, 0xf807, sound2_shared_ram_w,&sound_shared_ram },
  9372.     { 0xf808, 0xffff, MWA_RAM },
  9373.     { -1 }  /* end of table */
  9374. };
  9375.  
  9376. /***************************************************************************/
  9377.  
  9378. static void shangon_update_proc( void ){
  9379.     int leds;
  9380.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
  9381.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
  9382.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
  9383.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
  9384.  
  9385.     set_fg_page1( READ_WORD( &sys16_textram[0x0e9e] ) );
  9386.     set_bg_page1( READ_WORD( &sys16_textram[0x0e9c] ) );
  9387.  
  9388.     set_refresh_3d( READ_WORD( &sys16_extraram4[2] ) );
  9389.  
  9390.     leds=READ_WORD( &sys16_extraram4[0x2] );
  9391.  
  9392.     if(leds & 4)
  9393.     {
  9394.         osd_led_w(0,1);
  9395.         osd_led_w(1,1);
  9396.         osd_led_w(2,1);
  9397.     }
  9398.     else
  9399.     {
  9400.         osd_led_w(0,0);
  9401.         osd_led_w(1,0);
  9402.         osd_led_w(2,0);
  9403.     }
  9404.  
  9405. }
  9406.  
  9407. static void shangon_init_machine( void ){
  9408.     static int bank[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
  9409.     sys16_obj_bank = bank;
  9410.     sys16_textmode=1;
  9411.     sys16_spritesystem = 5;
  9412.     sys16_sprxoffset = -0xc0;
  9413.     sys16_fgxoffset = 8;
  9414.     sys16_textlayer_lo_min=0;
  9415.     sys16_textlayer_lo_max=0;
  9416.     sys16_textlayer_hi_min=0;
  9417.     sys16_textlayer_hi_max=0xff;
  9418.  
  9419.     patch_code( 0x65bd, 0xf9);
  9420.     patch_code( 0x6677, 0xfa);
  9421.     patch_code( 0x66d5, 0xfb);
  9422.     patch_code( 0x9621, 0xfb);
  9423.  
  9424.     sys16_update_proc = shangon_update_proc;
  9425.  
  9426.     gr_ver = &shared_ram[0x0];
  9427.     gr_hor = gr_ver+0x200;
  9428.     gr_pal = gr_ver+0x400;
  9429.     gr_flip= gr_ver+0x600;
  9430.     gr_palette= 0xf80 / 2;
  9431.     gr_palette_default = 0x70 /2;
  9432.     gr_colorflip[0][0]=0x08 / 2;
  9433.     gr_colorflip[0][1]=0x04 / 2;
  9434.     gr_colorflip[0][2]=0x00 / 2;
  9435.     gr_colorflip[0][3]=0x06 / 2;
  9436.     gr_colorflip[1][0]=0x0a / 2;
  9437.     gr_colorflip[1][1]=0x04 / 2;
  9438.     gr_colorflip[1][2]=0x02 / 2;
  9439.     gr_colorflip[1][3]=0x02 / 2;
  9440. }
  9441.  
  9442.  
  9443.  
  9444. static void init_shangon( void )
  9445. {
  9446.     sys16_onetime_init_machine();
  9447.  
  9448.     sys16_sprite_decode( 9,0x020000 );
  9449.     generate_gr_screen(512,1024,0,0,4,0x8000);
  9450.     //??
  9451.     patch_z80code( 0x1087, 0x20);
  9452.     patch_z80code( 0x1088, 0x01);
  9453. }
  9454.  
  9455. static void init_shangonb( void )
  9456. {
  9457.     sys16_onetime_init_machine();
  9458.  
  9459.     sys16_sprite_decode( 9,0x020000 );
  9460.     generate_gr_screen(512,1024,8,0,4,0x8000);
  9461. }
  9462. /***************************************************************************/
  9463.  
  9464. INPUT_PORTS_START( shangon )
  9465. PORT_START    /* Steering */
  9466.     PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_X | IPF_REVERSE | IPF_CENTER , 100, 3, 0x42, 0xbd )
  9467.  
  9468. #ifdef HANGON_DIGITAL_CONTROLS
  9469.  
  9470. PORT_START    /* Buttons */
  9471.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  9472.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  9473.  
  9474. #else
  9475.  
  9476. PORT_START    /* Accel / Decel */
  9477.     PORT_ANALOG( 0xff, 0x1, IPT_AD_STICK_Y | IPF_CENTER | IPF_REVERSE, 100, 16, 1, 0xa2 )
  9478.  
  9479. #endif
  9480.  
  9481. PORT_START
  9482.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  9483.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  9484.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  9485.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
  9486.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
  9487.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
  9488.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  9489.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  9490.  
  9491.     SYS16_COINAGE
  9492.  
  9493. PORT_START    /* DSW1 */
  9494.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
  9495.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  9496.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  9497.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
  9498.     PORT_DIPSETTING(    0x04, "Easy" )
  9499.     PORT_DIPSETTING(    0x06, "Normal" )
  9500.     PORT_DIPSETTING(    0x02, "Hard" )
  9501.     PORT_DIPSETTING(    0x00, "Hardest" )
  9502.     PORT_DIPNAME( 0x18, 0x18, "Time Adj." )
  9503.     PORT_DIPSETTING(    0x10, "Easy" )
  9504.     PORT_DIPSETTING(    0x18, "Normal" )
  9505.     PORT_DIPSETTING(    0x08, "Hard" )
  9506.     PORT_DIPSETTING(    0x00, "Hardest" )
  9507.     PORT_DIPNAME( 0x20, 0x20, "Play Music" )
  9508.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  9509.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  9510.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
  9511.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  9512.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  9513.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
  9514.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  9515.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  9516.  
  9517.  
  9518. #ifndef HANGON_DIGITAL_CONTROLS
  9519.  
  9520. PORT_START    /* Brake */
  9521.     PORT_ANALOG( 0xff, 0x1, IPT_AD_STICK_Y | IPF_PLAYER2 | IPF_CENTER | IPF_REVERSE, 100, 16, 1, 0xa2 )
  9522.  
  9523. #endif
  9524. INPUT_PORTS_END
  9525.  
  9526. /***************************************************************************/
  9527. static struct MachineDriver machine_driver_shangon =
  9528. {
  9529.     {
  9530.         {
  9531.             CPU_M68000,
  9532.             10000000,
  9533.             shangon_readmem,shangon_writemem,0,0,
  9534.             sys16_interrupt,1
  9535.         },
  9536.         {
  9537.             CPU_Z80 | CPU_AUDIO_CPU,
  9538.             4096000,
  9539.             shangon_sound_readmem,shangon_sound_writemem,sound_readport,sound_writeport,
  9540.             ignore_interrupt,1
  9541.         },
  9542.         {
  9543.             CPU_M68000,
  9544.             10000000,
  9545.             shangon_readmem2,shangon_writemem2,0,0,
  9546.             sys16_interrupt,1
  9547.         },
  9548.     },
  9549.     60, DEFAULT_60HZ_VBLANK_DURATION,
  9550.     1,
  9551.     shangon_init_machine,
  9552.     40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
  9553.     gfx8,
  9554.     2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
  9555.     0,
  9556.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  9557.     0,
  9558.     sys16_ho_vh_start,
  9559.     sys16_vh_stop,
  9560.     sys16_ho_vh_screenrefresh,
  9561.     SOUND_SUPPORTS_STEREO,0,0,0,
  9562.     {
  9563.         {
  9564.             SOUND_YM2151,
  9565.             &ym2151_interface
  9566.         },
  9567.         {
  9568.             SOUND_SEGAPCM,
  9569.             &segapcm_interface_15k_512,
  9570.         }
  9571.     }
  9572. };
  9573.  
  9574. /***************************************************************************/
  9575. // Outrun hardware
  9576. ROM_START( outrun )
  9577.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  9578.     ROM_LOAD_EVEN( "10380a", 0x000000, 0x10000, 0x434fadbc )
  9579.     ROM_LOAD_ODD ( "10382a", 0x000000, 0x10000, 0x1ddcc04e )
  9580.     ROM_LOAD_EVEN( "10381a", 0x020000, 0x10000, 0xbe8c412b )
  9581.     ROM_LOAD_ODD ( "10383a", 0x020000, 0x10000, 0xdcc586e7 )
  9582.  
  9583.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  9584.     ROM_LOAD( "10268", 0x00000, 0x08000, 0x95344b04 )
  9585.     ROM_LOAD( "10232", 0x08000, 0x08000, 0x776ba1eb )
  9586.     ROM_LOAD( "10267", 0x10000, 0x08000, 0xa85bb823 )
  9587.     ROM_LOAD( "10231", 0x18000, 0x08000, 0x8908bcbf )
  9588.     ROM_LOAD( "10266", 0x20000, 0x08000, 0x9f6f1a74 )
  9589.     ROM_LOAD( "10230", 0x28000, 0x08000, 0x686f5e50 )
  9590.  
  9591.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  9592.     ROM_LOAD( "10371", 0x000000, 0x010000, 0x0a1c98de )
  9593.     ROM_CONTINUE(      0x080000, 0x010000 )
  9594.     ROM_LOAD( "10373", 0x010000, 0x010000, 0x339f8e64 )
  9595.     ROM_CONTINUE(      0x090000, 0x010000 )
  9596.     ROM_LOAD( "10375", 0x020000, 0x010000, 0x62a472bd )
  9597.     ROM_CONTINUE(      0x0a0000, 0x010000 )
  9598.     ROM_LOAD( "10377", 0x030000, 0x010000, 0xc86daecb )
  9599.     ROM_CONTINUE(      0x0b0000, 0x010000 )
  9600.  
  9601.     ROM_LOAD( "10372", 0x040000, 0x010000, 0x1640ad1f )
  9602.     ROM_CONTINUE(      0x0c0000, 0x010000 )
  9603.     ROM_LOAD( "10374", 0x050000, 0x010000, 0x22744340 )
  9604.     ROM_CONTINUE(      0x0d0000, 0x010000 )
  9605.     ROM_LOAD( "10376", 0x060000, 0x010000, 0x8337ace7 )
  9606.     ROM_CONTINUE(      0x0e0000, 0x010000 )
  9607.     ROM_LOAD( "10378", 0x070000, 0x010000, 0x544068fd )
  9608.     ROM_CONTINUE(      0x0f0000, 0x010000 )
  9609.  
  9610.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  9611.     ROM_LOAD( "10187",       0x00000, 0x008000, 0xa10abaa9 )
  9612.  
  9613.     ROM_REGION( 0x38000, REGION_SOUND1 ) /* Sega PCM sound data */
  9614.     ROM_LOAD( "10193",       0x00000, 0x008000, 0xbcd10dde )
  9615.     ROM_RELOAD(              0x30000, 0x008000 ) // twice??
  9616.     ROM_LOAD( "10192",       0x08000, 0x008000, 0x770f1270 )
  9617.     ROM_LOAD( "10191",       0x10000, 0x008000, 0x20a284ab )
  9618.     ROM_LOAD( "10190",       0x18000, 0x008000, 0x7cab70e2 )
  9619.     ROM_LOAD( "10189",       0x20000, 0x008000, 0x01366b54 )
  9620.     ROM_LOAD( "10188",       0x28000, 0x008000, 0xbad30ad9 )
  9621.  
  9622.     ROM_REGION( 0x40000, REGION_CPU3 ) /* second 68000 CPU */
  9623.     ROM_LOAD_EVEN("10327a", 0x00000, 0x10000, 0xe28a5baf )
  9624.     ROM_LOAD_ODD( "10329a", 0x00000, 0x10000, 0xda131c81 )
  9625.     ROM_LOAD_EVEN("10328a", 0x20000, 0x10000, 0xd5ec5e5d )
  9626.     ROM_LOAD_ODD( "10330a", 0x20000, 0x10000, 0xba9ec82a )
  9627.  
  9628.     ROM_REGION( 0x80000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
  9629.     ROM_LOAD( "10185", 0x0000, 0x8000, 0x22794426 )
  9630. ROM_END
  9631.  
  9632. ROM_START( outruna )
  9633.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  9634.     ROM_LOAD_EVEN( "10380b", 0x000000, 0x10000, 0x1f6cadad )
  9635.     ROM_LOAD_ODD ( "10382b", 0x000000, 0x10000, 0xc4c3fa1a )
  9636.     ROM_LOAD_EVEN( "10381a", 0x020000, 0x10000, 0xbe8c412b )
  9637.     ROM_LOAD_ODD ( "10383b", 0x020000, 0x10000, 0x10a2014a )
  9638.  
  9639.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  9640.     ROM_LOAD( "10268", 0x00000, 0x08000, 0x95344b04 )
  9641.     ROM_LOAD( "10232", 0x08000, 0x08000, 0x776ba1eb )
  9642.     ROM_LOAD( "10267", 0x10000, 0x08000, 0xa85bb823 )
  9643.     ROM_LOAD( "10231", 0x18000, 0x08000, 0x8908bcbf )
  9644.     ROM_LOAD( "10266", 0x20000, 0x08000, 0x9f6f1a74 )
  9645.     ROM_LOAD( "10230", 0x28000, 0x08000, 0x686f5e50 )
  9646.  
  9647.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  9648.     ROM_LOAD( "10371", 0x000000, 0x010000, 0x0a1c98de )
  9649.     ROM_CONTINUE(      0x080000, 0x010000 )
  9650.     ROM_LOAD( "10373", 0x010000, 0x010000, 0x339f8e64 )
  9651.     ROM_CONTINUE(      0x090000, 0x010000 )
  9652.     ROM_LOAD( "10375", 0x020000, 0x010000, 0x62a472bd )
  9653.     ROM_CONTINUE(      0x0a0000, 0x010000 )
  9654.     ROM_LOAD( "10377", 0x030000, 0x010000, 0xc86daecb )
  9655.     ROM_CONTINUE(      0x0b0000, 0x010000 )
  9656.  
  9657.     ROM_LOAD( "10372", 0x040000, 0x010000, 0x1640ad1f )
  9658.     ROM_CONTINUE(      0x0c0000, 0x010000 )
  9659.     ROM_LOAD( "10374", 0x050000, 0x010000, 0x22744340 )
  9660.     ROM_CONTINUE(      0x0d0000, 0x010000 )
  9661.     ROM_LOAD( "10376", 0x060000, 0x010000, 0x8337ace7 )
  9662.     ROM_CONTINUE(      0x0e0000, 0x010000 )
  9663.     ROM_LOAD( "10378", 0x070000, 0x010000, 0x544068fd )
  9664.     ROM_CONTINUE(      0x0f0000, 0x010000 )
  9665.  
  9666.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  9667.     ROM_LOAD( "10187",       0x00000, 0x008000, 0xa10abaa9 )
  9668.  
  9669.     ROM_REGION( 0x38000, REGION_SOUND1 ) /* Sega PCM sound data */
  9670.     ROM_LOAD( "10193",       0x00000, 0x008000, 0xbcd10dde )
  9671.     ROM_RELOAD(              0x30000, 0x008000 ) // twice??
  9672.     ROM_LOAD( "10192",       0x08000, 0x008000, 0x770f1270 )
  9673.     ROM_LOAD( "10191",       0x10000, 0x008000, 0x20a284ab )
  9674.     ROM_LOAD( "10190",       0x18000, 0x008000, 0x7cab70e2 )
  9675.     ROM_LOAD( "10189",       0x20000, 0x008000, 0x01366b54 )
  9676.     ROM_LOAD( "10188",       0x28000, 0x008000, 0xbad30ad9 )
  9677.  
  9678.     ROM_REGION( 0x40000, REGION_CPU3 ) /* second 68000 CPU */
  9679.     ROM_LOAD_EVEN("10327a", 0x00000, 0x10000, 0xe28a5baf )
  9680.     ROM_LOAD_ODD( "10329a", 0x00000, 0x10000, 0xda131c81 )
  9681.     ROM_LOAD_EVEN("10328a", 0x20000, 0x10000, 0xd5ec5e5d )
  9682.     ROM_LOAD_ODD( "10330a", 0x20000, 0x10000, 0xba9ec82a )
  9683.  
  9684.     ROM_REGION( 0x80000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
  9685.     ROM_LOAD( "10185", 0x0000, 0x8000, 0x22794426 )
  9686. ROM_END
  9687.  
  9688.  
  9689. ROM_START( outrunb )
  9690.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  9691.     ROM_LOAD_EVEN( "orun_mn.rom", 0x000000, 0x10000, 0xcddceea2 )
  9692.     ROM_LOAD_ODD ( "orun_ml.rom", 0x000000, 0x10000, 0x9cfc07d5 )
  9693.     ROM_LOAD_EVEN( "orun_mm.rom", 0x020000, 0x10000, 0x3092d857 )
  9694.     ROM_LOAD_ODD ( "orun_mk.rom", 0x020000, 0x10000, 0x30a1c496 )
  9695.  
  9696.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  9697.     ROM_LOAD( "10268", 0x00000, 0x08000, 0x95344b04 )
  9698.     ROM_LOAD( "10232", 0x08000, 0x08000, 0x776ba1eb )
  9699.     ROM_LOAD( "10267", 0x10000, 0x08000, 0xa85bb823 )
  9700.     ROM_LOAD( "10231", 0x18000, 0x08000, 0x8908bcbf )
  9701.     ROM_LOAD( "10266", 0x20000, 0x08000, 0x9f6f1a74 )
  9702.     ROM_LOAD( "10230", 0x28000, 0x08000, 0x686f5e50 )
  9703.  
  9704.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  9705.     ROM_LOAD( "orun_1.rom", 0x000000, 0x010000, 0x77377e00 )
  9706.     ROM_LOAD( "orun_3.rom", 0x010000, 0x010000, 0x69ecc975 )
  9707.     ROM_LOAD( "orun_5.rom", 0x020000, 0x010000, 0xb6a8d0e2 )
  9708.     ROM_LOAD( "orun_7.rom", 0x030000, 0x010000, 0xd632d8a2 )
  9709.  
  9710.     ROM_LOAD( "orun_2.rom", 0x040000, 0x010000, 0x2c0e7277 )
  9711.     ROM_LOAD( "orun_4.rom", 0x050000, 0x010000, 0x54761e57 )
  9712.     ROM_LOAD( "orun_6.rom", 0x060000, 0x010000, 0xa00d0676 )
  9713.     ROM_LOAD( "orun_8.rom", 0x070000, 0x010000, 0xda398368 )
  9714.  
  9715.     ROM_LOAD( "orun_17.rom", 0x080000, 0x010000, 0x4f784236 )
  9716.     ROM_LOAD( "orun_19.rom", 0x090000, 0x010000, 0xee4f7154 )
  9717.     ROM_LOAD( "orun_21.rom", 0x0a0000, 0x010000, 0xe9880aa3 )
  9718.     ROM_LOAD( "orun_23.rom", 0x0b0000, 0x010000, 0xdc286dc2 )
  9719.  
  9720.     ROM_LOAD( "orun_18.rom", 0x0c0000, 0x010000, 0x8d459356 )
  9721.     ROM_LOAD( "orun_20.rom", 0x0d0000, 0x010000, 0xc2825654 )
  9722.     ROM_LOAD( "orun_22.rom", 0x0e0000, 0x010000, 0xef7d06fe )
  9723.     ROM_LOAD( "orun_24.rom", 0x0f0000, 0x010000, 0x1222af9f )
  9724.  
  9725.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  9726.     ROM_LOAD( "orun_ma.rom", 0x00000, 0x008000, 0xa3ff797a )
  9727.  
  9728.     ROM_REGION( 0x38000, REGION_SOUND1 ) /* Sega PCM sound data */
  9729.     ROM_LOAD( "10193",       0x00000, 0x008000, 0xbcd10dde )
  9730.     ROM_RELOAD(              0x30000, 0x008000 ) // twice??
  9731.     ROM_LOAD( "10192",       0x08000, 0x008000, 0x770f1270 )
  9732.     ROM_LOAD( "10191",       0x10000, 0x008000, 0x20a284ab )
  9733.     ROM_LOAD( "10190",       0x18000, 0x008000, 0x7cab70e2 )
  9734.     ROM_LOAD( "10189",       0x20000, 0x008000, 0x01366b54 )
  9735.     ROM_LOAD( "10188",       0x28000, 0x008000, 0xbad30ad9 )
  9736.  
  9737.     ROM_REGION( 0x40000, REGION_CPU3 ) /* second 68000 CPU */
  9738.     ROM_LOAD_EVEN("orun_mj.rom", 0x00000, 0x10000, 0xd7f5aae0 )
  9739.     ROM_LOAD_ODD( "orun_mh.rom", 0x00000, 0x10000, 0x88c2e78f )
  9740.     ROM_LOAD_EVEN("10328a",      0x20000, 0x10000, 0xd5ec5e5d )
  9741.     ROM_LOAD_ODD( "orun_mg.rom", 0x20000, 0x10000, 0x74c5fbec )
  9742.  
  9743.     ROM_REGION( 0x80000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
  9744.     ROM_LOAD( "orun_me.rom", 0x0000, 0x8000, 0x666fe754 )
  9745.  
  9746. //    ROM_LOAD( "orun_mf.rom", 0x0000, 0x8000, 0xed5bda9c )    //??
  9747. ROM_END
  9748.  
  9749. /***************************************************************************/
  9750.  
  9751. static READ_HANDLER( or_io_joy_r ){ return (input_port_5_r( offset ) << 8) + input_port_6_r( offset ); }
  9752.  
  9753. #ifdef HANGON_DIGITAL_CONTROLS
  9754. static READ_HANDLER( or_io_brake_r ){
  9755.     int data = input_port_1_r( offset );
  9756.  
  9757.     switch(data & 3)
  9758.     {
  9759.         case 3:    return 0xff00;    // both
  9760.         case 1:    return 0xff00;  // brake
  9761.         case 2:    return 0x0000;  // accel
  9762.         case 0:    return 0x0000;  // neither
  9763.     }
  9764.     return 0x0000;
  9765. }
  9766.  
  9767. static READ_HANDLER( or_io_acc_steer_r ){
  9768.     int data = input_port_1_r( offset );
  9769.     int ret = input_port_0_r( offset ) << 8;
  9770.  
  9771.     switch(data & 3)
  9772.     {
  9773.         case 3:    return 0x00 | ret;    // both
  9774.         case 1:    return 0x00 | ret;  // brake
  9775.         case 2:    return 0xff | ret;  // accel
  9776.         case 0:    return 0x00 | ret ;  // neither
  9777.     }
  9778.     return 0x00 | ret;
  9779. }
  9780. #else
  9781. static READ_HANDLER( or_io_acc_steer_r ){ return (input_port_0_r( offset ) << 8) + input_port_1_r( offset ); }
  9782. static READ_HANDLER( or_io_brake_r ){ return input_port_5_r( offset ) << 8; }
  9783. #endif
  9784.  
  9785. static int or_gear=0;
  9786.  
  9787. static READ_HANDLER( or_io_service_r )
  9788. {
  9789.     int ret=input_port_2_r( offset );
  9790.     int data=input_port_1_r( offset );
  9791.     if(data & 4) or_gear=0;
  9792.     else if(data & 8) or_gear=1;
  9793.  
  9794.     if(or_gear) ret|=0x10;
  9795.     else ret&=0xef;
  9796.  
  9797.     return ret;
  9798. }
  9799.  
  9800. static READ_HANDLER( or_reset2_r )
  9801. {
  9802.     cpu_set_reset_line(2,PULSE_LINE);
  9803.     return 0;
  9804. }
  9805.  
  9806.  
  9807. static struct MemoryReadAddress outrun_readmem[] =
  9808. {
  9809.     { 0x000000, 0x03ffff, MRA_ROM },
  9810.     { 0x060892, 0x060893, or_io_acc_steer_r },
  9811.     { 0x060894, 0x060895, or_io_brake_r },
  9812.     { 0x060900, 0x060907, sound_shared_ram_r },        //???
  9813.     { 0x060000, 0x067fff, MRA_EXTRAM5 },
  9814.  
  9815.     { 0x100000, 0x10ffff, MRA_TILERAM },
  9816.     { 0x110000, 0x110fff, MRA_TEXTRAM },
  9817.  
  9818.     { 0x130000, 0x130fff, MRA_SPRITERAM },
  9819.     { 0x120000, 0x121fff, MRA_PALETTERAM },
  9820.  
  9821.     { 0x140010, 0x140011, or_io_service_r },
  9822.     { 0x140014, 0x140015, io_dip1_r },
  9823.     { 0x140016, 0x140017, io_dip2_r },
  9824.  
  9825.     { 0x140000, 0x140071, MRA_EXTRAM3 },        //io
  9826.     { 0x200000, 0x23ffff, MRA_BANK8 },
  9827.     { 0x260000, 0x267fff, shared_ram_r },
  9828.     { 0xe00000, 0xe00001, or_reset2_r },
  9829.  
  9830.     {-1}
  9831. };
  9832.  
  9833. static WRITE_HANDLER( outrun_sound_write_w )
  9834. {
  9835.     sound_shared_ram[0]=data&0xff;
  9836. }
  9837.  
  9838. static struct MemoryWriteAddress outrun_writemem[] =
  9839. {
  9840.     { 0x000000, 0x03ffff, MWA_ROM },
  9841.     { 0x060900, 0x060907, sound_shared_ram_w },        //???
  9842.     { 0x060000, 0x067fff, MWA_EXTRAM5 },
  9843.  
  9844.     { 0x100000, 0x10ffff, MWA_TILERAM },
  9845.     { 0x110000, 0x110fff, MWA_TEXTRAM },
  9846.  
  9847.     { 0x130000, 0x130fff, MWA_SPRITERAM },
  9848.     { 0x120000, 0x121fff, MWA_PALETTERAM },
  9849.  
  9850.     { 0x140000, 0x140071, MWA_EXTRAM3 },        //io
  9851.     { 0x200000, 0x23ffff, MWA_BANK8 },
  9852.     { 0x260000, 0x267fff, shared_ram_w, &shared_ram },
  9853.     { 0xffff06, 0xffff07, outrun_sound_write_w },
  9854.  
  9855.     {-1}
  9856. };
  9857.  
  9858. static struct MemoryReadAddress outrun_readmem2[] =
  9859. {
  9860.     { 0x000000, 0x03ffff, MRA_ROM },
  9861.     { 0x060000, 0x067fff, shared_ram_r },
  9862.     { 0x080000, 0x09ffff, MRA_EXTRAM },        // gr
  9863.  
  9864.     {-1}
  9865. };
  9866.  
  9867. static struct MemoryWriteAddress outrun_writemem2[] =
  9868. {
  9869.     { 0x000000, 0x03ffff, MWA_ROM },
  9870.     { 0x060000, 0x067fff, shared_ram_w },
  9871.     { 0x080000, 0x09ffff, MWA_EXTRAM },        // gr
  9872.  
  9873.     {-1}
  9874. };
  9875.  
  9876. // Outrun
  9877.  
  9878. static struct MemoryReadAddress outrun_sound_readmem[] =
  9879. {
  9880.     { 0x0000, 0x7fff, MRA_ROM },
  9881.     { 0xf000, 0xf0ff, SegaPCM_r },
  9882.     { 0xf100, 0xf7ff, MRA_NOP },
  9883.     { 0xf800, 0xf807, sound2_shared_ram_r },
  9884.     { 0xf808, 0xffff, MRA_RAM },
  9885.     { -1 }  /* end of table */
  9886. };
  9887.  
  9888. static struct MemoryWriteAddress outrun_sound_writemem[] =
  9889. {
  9890.     { 0x0000, 0x7fff, MWA_ROM },
  9891.     { 0xf000, 0xf0ff, SegaPCM_w },
  9892.     { 0xf100, 0xf7ff, MWA_NOP },
  9893.     { 0xf800, 0xf807, sound2_shared_ram_w,&sound_shared_ram },
  9894.     { 0xf808, 0xffff, MWA_RAM },
  9895.     { -1 }  /* end of table */
  9896. };
  9897.  
  9898. /***************************************************************************/
  9899.  
  9900. static void outrun_update_proc( void ){
  9901.     int data;
  9902.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
  9903.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
  9904.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
  9905.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
  9906.     set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
  9907.     set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
  9908.  
  9909.     set_refresh( READ_WORD( &sys16_extraram5[0xb6e] ) );
  9910.     data=READ_WORD( &sys16_extraram5[0xb6c] );
  9911.  
  9912.     if(data & 0x2)
  9913.     {
  9914.         osd_led_w(0,1);
  9915.         osd_led_w(2,1);
  9916.     }
  9917.     else
  9918.     {
  9919.         osd_led_w(0,0);
  9920.         osd_led_w(2,0);
  9921.     }
  9922.  
  9923.     if(data & 0x4)
  9924.         osd_led_w(1,1);
  9925.     else
  9926.         osd_led_w(1,0);
  9927. }
  9928.  
  9929. static void outrun_init_machine( void ){
  9930.     static int bank[16] = { 07,00,01,04,05,02,03,06,00,00,00,00,00,00,00,00};
  9931.     sys16_obj_bank = bank;
  9932.     sys16_spritesystem = 7;
  9933.     sys16_textlayer_lo_min=0;
  9934.     sys16_textlayer_lo_max=0;
  9935.     sys16_textlayer_hi_min=0;
  9936.     sys16_textlayer_hi_max=0xff;
  9937.     sys16_sprxoffset = -0xc0;
  9938.  
  9939. // cpu 0 reset opcode resets cpu 2?
  9940.     patch_code(0x7d44,0x4a);
  9941.     patch_code(0x7d45,0x79);
  9942.     patch_code(0x7d46,0x00);
  9943.     patch_code(0x7d47,0xe0);
  9944.     patch_code(0x7d48,0x00);
  9945.     patch_code(0x7d49,0x00);
  9946.  
  9947. // *forced sound cmd
  9948.     patch_code( 0x55ed, 0x00);
  9949.  
  9950. // rogue tile on music selection screen
  9951. //    patch_code( 0x38545, 0x80);
  9952.  
  9953. // *freeze time
  9954. //    patch_code( 0xb6b6, 0x4e);
  9955. //    patch_code( 0xb6b7, 0x71);
  9956.  
  9957.     cpu_setbank(8, memory_region(REGION_CPU3));
  9958.  
  9959.     sys16_update_proc = outrun_update_proc;
  9960.  
  9961.     gr_ver = &sys16_extraram[0];
  9962.     gr_hor = gr_ver+0x400;
  9963.     gr_flip= gr_ver+0xc00;
  9964.     gr_palette= 0xf00 / 2;
  9965.     gr_palette_default = 0x800 /2;
  9966.     gr_colorflip[0][0]=0x08 / 2;
  9967.     gr_colorflip[0][1]=0x04 / 2;
  9968.     gr_colorflip[0][2]=0x00 / 2;
  9969.     gr_colorflip[0][3]=0x00 / 2;
  9970.     gr_colorflip[1][0]=0x0a / 2;
  9971.     gr_colorflip[1][1]=0x06 / 2;
  9972.     gr_colorflip[1][2]=0x02 / 2;
  9973.     gr_colorflip[1][3]=0x00 / 2;
  9974.  
  9975.     gr_second_road = &sys16_extraram[0x10000];
  9976.  
  9977. }
  9978.  
  9979. static void outruna_init_machine( void ){
  9980.     static int bank[16] = { 07,00,01,04,05,02,03,06,00,00,00,00,00,00,00,00};
  9981.     sys16_obj_bank = bank;
  9982.     sys16_spritesystem = 7;
  9983.     sys16_textlayer_lo_min=0;
  9984.     sys16_textlayer_lo_max=0;
  9985.     sys16_textlayer_hi_min=0;
  9986.     sys16_textlayer_hi_max=0xff;
  9987.  
  9988. // cpu 0 reset opcode resets cpu 2?
  9989.     patch_code(0x7db8,0x4a);
  9990.     patch_code(0x7db9,0x79);
  9991.     patch_code(0x7dba,0x00);
  9992.     patch_code(0x7dbb,0xe0);
  9993.     patch_code(0x7dbc,0x00);
  9994.     patch_code(0x7dbd,0x00);
  9995.  
  9996. // *forced sound cmd
  9997.     patch_code( 0x5661, 0x00);
  9998.  
  9999. // rogue tile on music selection screen
  10000. //    patch_code( 0x38455, 0x80);
  10001.  
  10002. // *freeze time
  10003. //    patch_code( 0xb6b6, 0x4e);
  10004. //    patch_code( 0xb6b7, 0x71);
  10005.  
  10006.     cpu_setbank(8, memory_region(REGION_CPU3));
  10007.  
  10008.     sys16_update_proc = outrun_update_proc;
  10009.  
  10010.     gr_ver = &sys16_extraram[0];
  10011.     gr_hor = gr_ver+0x400;
  10012.     gr_flip= gr_ver+0xc00;
  10013.     gr_palette= 0xf00 / 2;
  10014.     gr_palette_default = 0x800 /2;
  10015.     gr_colorflip[0][0]=0x08 / 2;
  10016.     gr_colorflip[0][1]=0x04 / 2;
  10017.     gr_colorflip[0][2]=0x00 / 2;
  10018.     gr_colorflip[0][3]=0x00 / 2;
  10019.     gr_colorflip[1][0]=0x0a / 2;
  10020.     gr_colorflip[1][1]=0x06 / 2;
  10021.     gr_colorflip[1][2]=0x02 / 2;
  10022.     gr_colorflip[1][3]=0x00 / 2;
  10023.  
  10024.     gr_second_road = &sys16_extraram[0x10000];
  10025.  
  10026. }
  10027.  
  10028. static void init_outrun( void )
  10029. {
  10030.     sys16_onetime_init_machine();
  10031.     sys16_sprite_decode2( 4,0x040000, 0 );
  10032.     generate_gr_screen(512,2048,0,0,3,0x8000);
  10033. }
  10034.  
  10035. static void init_outrunb( void )
  10036. {
  10037.     unsigned char *RAM = memory_region(REGION_CPU1);
  10038.     int i;
  10039.     int odd,even,word;
  10040.     sys16_onetime_init_machine();
  10041. /*
  10042.   Main Processor
  10043.     Comparing the bootleg with the custom bootleg, it seems that:-
  10044.  
  10045.   if even bytes &0x28 == 0x20 or 0x08 then they are xored with 0x28
  10046.   if odd bytes &0xc0 == 0x40 or 0x80 then they are xored with 0xc0
  10047.  
  10048.   ie. data lines are switched.
  10049. */
  10050.  
  10051.     for(i=0;i<0x40000;i+=2)
  10052.     {
  10053.         word=READ_WORD(&RAM[i]);
  10054.         even=word>>8;
  10055.         odd=word&0xff;
  10056.         // even byte
  10057.         if((even&0x28) == 0x20 || (even&0x28) == 0x08)
  10058.             even^=0x28;
  10059.         // odd byte
  10060.         if((odd&0xc0) == 0x80 || (odd&0xc0) == 0x40)
  10061.             odd^=0xc0;
  10062.         word=(even<<8)+odd;
  10063.         WRITE_WORD(&RAM[i],word);
  10064.     }
  10065.  
  10066. /*
  10067.   Second Processor
  10068.  
  10069.   if even bytes &0xc0 == 0x40 or 0x80 then they are xored with 0xc0
  10070.   if odd bytes &0x0c == 0x04 or 0x08 then they are xored with 0x0c
  10071. */
  10072.     RAM = memory_region(REGION_CPU3);
  10073.     for(i=0;i<0x40000;i+=2)
  10074.     {
  10075.         word=READ_WORD(&RAM[i]);
  10076.         even=word>>8;
  10077.         odd=word&0xff;
  10078.         // even byte
  10079.         if((even&0xc0) == 0x80 || (even&0xc0) == 0x40)
  10080.             even^=0xc0;
  10081.         // odd byte
  10082.         if((odd&0x0c) == 0x08 || (odd&0x0c) == 0x04)
  10083.             odd^=0x0c;
  10084.         word=(even<<8)+odd;
  10085.         WRITE_WORD(&RAM[i],word);
  10086.     }
  10087. /*
  10088.   Road GFX
  10089.  
  10090.     rom orun_me.rom
  10091.     if bytes &0x60 == 0x40 or 0x20 then they are xored with 0x60
  10092.  
  10093.     rom orun_mf.rom
  10094.     if bytes &0xc0 == 0x40 or 0x80 then they are xored with 0xc0
  10095.  
  10096.   I don't know why there's 2 road roms, but I'm using orun_me.rom
  10097. */
  10098.     RAM = memory_region(REGION_GFX3);
  10099.     for(i=0;i<0x8000;i++)
  10100.     {
  10101.         if((RAM[i]&0x60) == 0x20 || (RAM[i]&0x60) == 0x40)
  10102.             RAM[i]^=0x60;
  10103.     }
  10104.  
  10105.     generate_gr_screen(512,2048,0,0,3,0x8000);
  10106.  
  10107. /*
  10108.   Z80 Code
  10109.     rom orun_ma.rom
  10110.     if bytes &0x60 == 0x40 or 0x20 then they are xored with 0x60
  10111.  
  10112. */
  10113.     RAM = memory_region(REGION_CPU2);
  10114.     for(i=0;i<0x8000;i++)
  10115.     {
  10116.         if((RAM[i]&0x60) == 0x20 || (RAM[i]&0x60) == 0x40)
  10117.             RAM[i]^=0x60;
  10118.     }
  10119.  
  10120.     sys16_sprite_decode2( 4,0x040000,0  );
  10121. }
  10122.  
  10123. /***************************************************************************/
  10124.  
  10125. INPUT_PORTS_START( outrun )
  10126. PORT_START    /* Steering */
  10127.     PORT_ANALOG( 0xff, 0x80, IPT_AD_STICK_X | IPF_CENTER, 100, 3, 0x48, 0xb8 )
  10128. //    PORT_ANALOG( 0xff, 0x7f, IPT_PADDLE , 70, 3, 0x48, 0xb8 )
  10129.  
  10130. #ifdef HANGON_DIGITAL_CONTROLS
  10131.  
  10132. PORT_START    /* Buttons */
  10133.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  10134.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  10135.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 )
  10136.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 )
  10137.  
  10138. #else
  10139.  
  10140. PORT_START    /* Accel / Decel */
  10141.     PORT_ANALOG( 0xff, 0x30, IPT_AD_STICK_Y | IPF_CENTER | IPF_REVERSE, 100, 16, 0x30, 0x90 )
  10142.  
  10143. #endif
  10144.  
  10145. PORT_START
  10146.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
  10147.     PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  10148.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  10149.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  10150. //    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
  10151.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  10152.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  10153.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  10154.  
  10155.     SYS16_COINAGE
  10156.  
  10157. PORT_START    /* DSW1 */
  10158.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Cabinet ) )
  10159.     PORT_DIPSETTING(    0x02, "Up Cockpit" )
  10160.     PORT_DIPSETTING(    0x01, "Mini Up" )
  10161.     PORT_DIPSETTING(    0x03, "Moving" )
  10162. //    PORT_DIPSETTING(    0x00, "No Use" )
  10163.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
  10164.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  10165.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  10166.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
  10167.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  10168.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  10169.     PORT_DIPNAME( 0x30, 0x30, "Time" )
  10170.     PORT_DIPSETTING(    0x20, "Easy" )
  10171.     PORT_DIPSETTING(    0x30, "Normal" )
  10172.     PORT_DIPSETTING(    0x10, "Hard" )
  10173.     PORT_DIPSETTING(    0x00, "Hardest" )
  10174.     PORT_DIPNAME( 0xc0, 0xc0, "Enemies" )
  10175.     PORT_DIPSETTING(    0x80, "Easy" )
  10176.     PORT_DIPSETTING(    0xc0, "Normal" )
  10177.     PORT_DIPSETTING(    0x40, "Hard" )
  10178.     PORT_DIPSETTING(    0x00, "Hardest" )
  10179.  
  10180.  
  10181. #ifndef HANGON_DIGITAL_CONTROLS
  10182.  
  10183. PORT_START    /* Brake */
  10184.     PORT_ANALOG( 0xff, 0x30, IPT_AD_STICK_Y | IPF_PLAYER2 | IPF_CENTER | IPF_REVERSE, 100, 16, 0x30, 0x90 )
  10185.  
  10186. #endif
  10187.  
  10188. INPUT_PORTS_END
  10189.  
  10190. /***************************************************************************/
  10191. static int or_interrupt( void ){
  10192.     int intleft=cpu_getiloops();
  10193.     if(intleft!=0) return 2;
  10194.     else return 4;
  10195. }
  10196.  
  10197.  
  10198. #define MACHINE_DRIVER_OUTRUN( GAMENAME,INITMACHINE) \
  10199. static struct MachineDriver GAMENAME = \
  10200. { \
  10201.     { \
  10202.         { \
  10203.             CPU_M68000, \
  10204.             12000000, \
  10205.             outrun_readmem,outrun_writemem,0,0, \
  10206.             or_interrupt,2 \
  10207.         }, \
  10208.         { \
  10209.             CPU_Z80 | CPU_AUDIO_CPU, \
  10210.             4096000, \
  10211.             outrun_sound_readmem,outrun_sound_writemem,sound_readport,sound_writeport, \
  10212.             ignore_interrupt,1 \
  10213.         }, \
  10214.         { \
  10215.             CPU_M68000, \
  10216.             12000000, \
  10217.             outrun_readmem2,outrun_writemem2,0,0, \
  10218.             sys16_interrupt,2 \
  10219.         }, \
  10220.     }, \
  10221.     60, 100 /*DEFAULT_60HZ_VBLANK_DURATION*/, \
  10222.     4, /* needed to sync processors */ \
  10223.     INITMACHINE, \
  10224.     40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 }, \
  10225.     gfx1, \
  10226.     4096*ShadowColorsMultiplier,4096*ShadowColorsMultiplier, \
  10227.     0, \
  10228.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_AFTER_VBLANK, \
  10229.     0, \
  10230.     sys16_or_vh_start, \
  10231.     sys16_vh_stop, \
  10232.     sys16_or_vh_screenrefresh, \
  10233.     SOUND_SUPPORTS_STEREO,0,0,0, \
  10234.     { \
  10235.         { \
  10236.             SOUND_YM2151, \
  10237.             &ym2151_interface \
  10238.         }, \
  10239.         { \
  10240.             SOUND_SEGAPCM, \
  10241.             &segapcm_interface_15k, \
  10242.         } \
  10243.     } \
  10244. };
  10245.  
  10246. MACHINE_DRIVER_OUTRUN(machine_driver_outrun,outrun_init_machine)
  10247. MACHINE_DRIVER_OUTRUN(machine_driver_outruna,outruna_init_machine)
  10248.  
  10249. /*****************************************************************************/
  10250. // Enduro Racer
  10251.  
  10252. ROM_START( enduror )
  10253.     ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
  10254.     ROM_LOAD_EVEN( "7640a.rom",0x00000, 0x8000, 0x1d1dc5d4 )
  10255.     ROM_LOAD_ODD ( "7636a.rom",0x00000, 0x8000, 0x84131639 )
  10256.  
  10257.     ROM_LOAD_EVEN( "7641.rom", 0x10000, 0x8000, 0x2503ae7c )
  10258.     ROM_LOAD_ODD ( "7637.rom", 0x10000, 0x8000, 0x82a27a8c )
  10259.     ROM_LOAD_EVEN( "7642.rom", 0x20000, 0x8000, 0x1c453bea )    // enduro.a06 / .a09
  10260.     ROM_LOAD_ODD ( "7638.rom", 0x20000, 0x8000, 0x70544779 )    // looks like encrypted versions of
  10261.  
  10262.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  10263.     ROM_LOAD( "7644.rom", 0x00000, 0x08000, 0xe7a4ff90 )
  10264.     ROM_LOAD( "7645.rom", 0x08000, 0x08000, 0x4caa0095 )
  10265.     ROM_LOAD( "7646.rom", 0x10000, 0x08000, 0x7e432683 )
  10266.  
  10267.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  10268.  
  10269.     ROM_LOAD( "7678.rom", 0x000000, 0x008000, 0x9fb5e656 )
  10270.     ROM_LOAD( "7670.rom", 0x008000, 0x008000, 0xdbbe2f6e )
  10271.     ROM_LOAD( "7662.rom", 0x010000, 0x008000, 0xcb0c13c5 )
  10272.     ROM_LOAD( "7654.rom", 0x018000, 0x008000, 0x2db6520d )
  10273.  
  10274.     ROM_LOAD( "7677.rom", 0x020000, 0x008000, 0x7764765b )
  10275.     ROM_LOAD( "7669.rom", 0x028000, 0x008000, 0xf9525faa )
  10276.     ROM_LOAD( "7661.rom", 0x030000, 0x008000, 0xfe93a79b )
  10277.     ROM_LOAD( "7653.rom", 0x038000, 0x008000, 0x46a52114 )
  10278.  
  10279.     ROM_LOAD( "7676.rom", 0x040000, 0x008000, 0x2e42e0d4 )
  10280.     ROM_LOAD( "7668.rom", 0x048000, 0x008000, 0xe115ce33 )
  10281.     ROM_LOAD( "7660.rom", 0x050000, 0x008000, 0x86dfbb68 )
  10282.     ROM_LOAD( "7652.rom", 0x058000, 0x008000, 0x2880cfdb )
  10283.  
  10284.     ROM_LOAD( "7675.rom", 0x060000, 0x008000, 0x05cd2d61 )
  10285.     ROM_LOAD( "7667.rom", 0x068000, 0x008000, 0x923bde9d )
  10286.     ROM_LOAD( "7659.rom", 0x070000, 0x008000, 0x629dc8ce )
  10287.     ROM_LOAD( "7651.rom", 0x078000, 0x008000, 0xd7902bad )
  10288.  
  10289.     ROM_LOAD( "7674.rom", 0x080000, 0x008000, 0x1a129acf )
  10290.     ROM_LOAD( "7666.rom", 0x088000, 0x008000, 0x23697257 )
  10291.     ROM_LOAD( "7658.rom", 0x090000, 0x008000, 0x1677f24f )
  10292.     ROM_LOAD( "7650.rom", 0x098000, 0x008000, 0x642635ec )
  10293.  
  10294.     ROM_LOAD( "7673.rom", 0x0a0000, 0x008000, 0x82602394 )
  10295.     ROM_LOAD( "7665.rom", 0x0a8000, 0x008000, 0x12d77607 )
  10296.     ROM_LOAD( "7657.rom", 0x0b0000, 0x008000, 0x8158839c )
  10297.     ROM_LOAD( "7649.rom", 0x0b8000, 0x008000, 0x4edba14c )
  10298.  
  10299.     ROM_LOAD( "7672.rom", 0x0c0000, 0x008000, 0xd11452f7 )
  10300.     ROM_LOAD( "7664.rom", 0x0c8000, 0x008000, 0x0df2cfad )
  10301.     ROM_LOAD( "7656.rom", 0x0d0000, 0x008000, 0x6c741272 )
  10302.     ROM_LOAD( "7648.rom", 0x0d8000, 0x008000, 0x983ea830 )
  10303.  
  10304.     ROM_LOAD( "7671.rom", 0x0e0000, 0x008000, 0xb0c7fdc6 )
  10305.     ROM_LOAD( "7663.rom", 0x0e8000, 0x008000, 0x2b0b8f08 )
  10306.     ROM_LOAD( "7655.rom", 0x0f0000, 0x008000, 0x3433fe7b )
  10307.     ROM_LOAD( "7647.rom", 0x0f8000, 0x008000, 0x2e7fbec0 )
  10308.  
  10309.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  10310.     ROM_LOAD( "7682.rom", 0x00000, 0x008000, 0xc4efbf48 )
  10311.  
  10312.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* Sega PCM sound data */
  10313.     ROM_LOAD( "7681.rom", 0x00000, 0x008000, 0xbc0c4d12 )
  10314.     ROM_LOAD( "7680.rom", 0x08000, 0x008000, 0x627b3c8c )
  10315.  
  10316.     ROM_REGION( 0x10000, REGION_CPU3 ) /* second 68000 CPU */
  10317.     ROM_LOAD_EVEN("7634.rom", 0x0000, 0x8000, 0x3e07fd32 )
  10318.     ROM_LOAD_ODD ("7635.rom", 0x0000, 0x8000, 0x22f762ab )
  10319.     // alternate version??
  10320. //    ROM_LOAD_EVEN("7634a.rom", 0x0000, 0x8000, 0xaec83731 )
  10321. //    ROM_LOAD_ODD ("7635a.rom", 0x0000, 0x8000, 0xb2fce96f )
  10322.  
  10323.     ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
  10324.     ROM_LOAD( "7633.rom", 0x0000, 0x8000, 0x6f146210 )
  10325. ROM_END
  10326.  
  10327.  
  10328.  
  10329. ROM_START( endurobl )
  10330.     ROM_REGION( 0x040000+0x010000+0x040000, REGION_CPU1 ) /* 68000 code + space for RAM + space for decrypted opcodes */
  10331.     ROM_LOAD_EVEN( "7.13j", 0x030000, 0x08000, 0xf1d6b4b7 )
  10332.     ROM_CONTINUE (          0x000000, 0x08000 | ROMFLAG_ALTERNATE )
  10333.     ROM_LOAD_ODD ( "4.13h", 0x030000, 0x08000, 0x43bff873 )                        // rom de-coded
  10334.     ROM_CONTINUE (          0x000001, 0x08000 | ROMFLAG_ALTERNATE )        // data de-coded
  10335.  
  10336.     ROM_LOAD_EVEN( "8.14j", 0x010000, 0x08000, 0x2153154a )
  10337.     ROM_LOAD_ODD ( "5.14h", 0x010000, 0x08000, 0x0a97992c )
  10338.     ROM_LOAD_EVEN( "9.15j", 0x020000, 0x08000, 0xdb3bff1c )    // one byte difference from
  10339.     ROM_LOAD_ODD ( "6.15h", 0x020000, 0x08000, 0x54b1885a )    // enduro.a06 / enduro.a09
  10340.  
  10341.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  10342.     ROM_LOAD( "7644.rom", 0x00000, 0x08000, 0xe7a4ff90 )
  10343.     ROM_LOAD( "7645.rom", 0x08000, 0x08000, 0x4caa0095 )
  10344.     ROM_LOAD( "7646.rom", 0x10000, 0x08000, 0x7e432683 )
  10345.  
  10346.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  10347.     ROM_LOAD( "7678.rom", 0x000000, 0x008000, 0x9fb5e656 )
  10348.     ROM_LOAD( "7670.rom", 0x008000, 0x008000, 0xdbbe2f6e )
  10349.     ROM_LOAD( "7662.rom", 0x010000, 0x008000, 0xcb0c13c5 )
  10350.     ROM_LOAD( "7654.rom", 0x018000, 0x008000, 0x2db6520d )
  10351.  
  10352.     ROM_LOAD( "7677.rom", 0x020000, 0x008000, 0x7764765b )
  10353.     ROM_LOAD( "7669.rom", 0x028000, 0x008000, 0xf9525faa )
  10354.     ROM_LOAD( "7661.rom", 0x030000, 0x008000, 0xfe93a79b )
  10355.     ROM_LOAD( "7653.rom", 0x038000, 0x008000, 0x46a52114 )
  10356.  
  10357.     ROM_LOAD( "7676.rom", 0x040000, 0x008000, 0x2e42e0d4 )
  10358.     ROM_LOAD( "7668.rom", 0x048000, 0x008000, 0xe115ce33 )
  10359.     ROM_LOAD( "7660.rom", 0x050000, 0x008000, 0x86dfbb68 )
  10360.     ROM_LOAD( "7652.rom", 0x058000, 0x008000, 0x2880cfdb )
  10361.  
  10362.     ROM_LOAD( "7675.rom", 0x060000, 0x008000, 0x05cd2d61 )
  10363.     ROM_LOAD( "7667.rom", 0x068000, 0x008000, 0x923bde9d )
  10364.     ROM_LOAD( "7659.rom", 0x070000, 0x008000, 0x629dc8ce )
  10365.     ROM_LOAD( "7651.rom", 0x078000, 0x008000, 0xd7902bad )
  10366.  
  10367.     ROM_LOAD( "7674.rom", 0x080000, 0x008000, 0x1a129acf )
  10368.     ROM_LOAD( "7666.rom", 0x088000, 0x008000, 0x23697257 )
  10369.     ROM_LOAD( "7658.rom", 0x090000, 0x008000, 0x1677f24f )
  10370.     ROM_LOAD( "7650.rom", 0x098000, 0x008000, 0x642635ec )
  10371.  
  10372.     ROM_LOAD( "7673.rom", 0x0a0000, 0x008000, 0x82602394 )
  10373.     ROM_LOAD( "7665.rom", 0x0a8000, 0x008000, 0x12d77607 )
  10374.     ROM_LOAD( "7657.rom", 0x0b0000, 0x008000, 0x8158839c )
  10375.     ROM_LOAD( "7649.rom", 0x0b8000, 0x008000, 0x4edba14c )
  10376.  
  10377.     ROM_LOAD( "7672.rom", 0x0c0000, 0x008000, 0xd11452f7 )
  10378.     ROM_LOAD( "7664.rom", 0x0c8000, 0x008000, 0x0df2cfad )
  10379.     ROM_LOAD( "7656.rom", 0x0d0000, 0x008000, 0x6c741272 )
  10380.     ROM_LOAD( "7648.rom", 0x0d8000, 0x008000, 0x983ea830 )
  10381.  
  10382.     ROM_LOAD( "7671.rom", 0x0e0000, 0x008000, 0xb0c7fdc6 )
  10383.     ROM_LOAD( "7663.rom", 0x0e8000, 0x008000, 0x2b0b8f08 )
  10384.     ROM_LOAD( "7655.rom", 0x0f0000, 0x008000, 0x3433fe7b )
  10385.     ROM_LOAD( "7647.rom", 0x0f8000, 0x008000, 0x2e7fbec0 )
  10386.  
  10387.  
  10388.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  10389.     ROM_LOAD( "13.16d", 0x00000, 0x004000, 0x81c82fc9 )
  10390.     ROM_LOAD( "12.16e", 0x04000, 0x004000, 0x755bfdad )
  10391.  
  10392.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* Sega PCM sound data */
  10393.     ROM_LOAD( "7681.rom", 0x00000, 0x008000, 0xbc0c4d12 )
  10394.     ROM_LOAD( "7680.rom", 0x08000, 0x008000, 0x627b3c8c )
  10395.  
  10396.     ROM_REGION( 0x10000, REGION_CPU3 ) /* second 68000 CPU */
  10397.     ROM_LOAD_EVEN("7634.rom", 0x0000, 0x8000, 0x3e07fd32 )
  10398.     ROM_LOAD_ODD ("7635.rom", 0x0000, 0x8000, 0x22f762ab )
  10399.  
  10400.     ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
  10401.     ROM_LOAD( "7633.rom", 0x0000, 0x8000, 0x6f146210 )
  10402. ROM_END
  10403.  
  10404. ROM_START( endurob2 )
  10405.     ROM_REGION( 0x040000+0x010000+0x040000, REGION_CPU1 ) /* 68000 code + space for RAM + space for decrypted opcodes */
  10406.     ROM_LOAD_EVEN( "enduro.a07", 0x000000, 0x08000, 0x259069bc )
  10407.     ROM_LOAD_ODD ( "enduro.a04", 0x000000, 0x08000, 0xf584fbd9 )
  10408.     ROM_LOAD_EVEN( "enduro.a08", 0x010000, 0x08000, 0xd234918c )
  10409.     ROM_LOAD_ODD ( "enduro.a05", 0x010000, 0x08000, 0xa525dd57 )
  10410.     ROM_LOAD_EVEN( "enduro.a09", 0x020000, 0x08000, 0xf6391091 )
  10411.     ROM_LOAD_ODD ( "enduro.a06", 0x020000, 0x08000, 0x79b367d7 )
  10412.  
  10413.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  10414.     ROM_LOAD( "7644.rom", 0x00000, 0x08000, 0xe7a4ff90 )
  10415.     ROM_LOAD( "7645.rom", 0x08000, 0x08000, 0x4caa0095 )
  10416.     ROM_LOAD( "7646.rom", 0x10000, 0x08000, 0x7e432683 )
  10417.  
  10418.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  10419.  
  10420.     ROM_LOAD( "7678.rom", 0x000000, 0x008000, 0x9fb5e656 )
  10421.     ROM_LOAD( "7670.rom", 0x008000, 0x008000, 0xdbbe2f6e )
  10422.     ROM_LOAD( "7662.rom", 0x010000, 0x008000, 0xcb0c13c5 )
  10423.     ROM_LOAD( "7654.rom", 0x018000, 0x008000, 0x2db6520d )
  10424.  
  10425.     ROM_LOAD( "7677.rom", 0x020000, 0x008000, 0x7764765b )
  10426.     ROM_LOAD( "7669.rom", 0x028000, 0x008000, 0xf9525faa )
  10427.     ROM_LOAD( "enduro.a34", 0x030000, 0x008000, 0x296454d8 )
  10428.     ROM_LOAD( "7653.rom", 0x038000, 0x008000, 0x46a52114 )
  10429.  
  10430.     ROM_LOAD( "7676.rom", 0x040000, 0x008000, 0x2e42e0d4 )
  10431.     ROM_LOAD( "7668.rom", 0x048000, 0x008000, 0xe115ce33 )
  10432.     ROM_LOAD( "enduro.a35", 0x050000, 0x008000, 0x1ebe76df )
  10433.     ROM_LOAD( "7652.rom", 0x058000, 0x008000, 0x2880cfdb )
  10434.  
  10435.     ROM_LOAD( "enduro.a20", 0x060000, 0x008000, 0x7c280bc8 )
  10436.     ROM_LOAD( "enduro.a28", 0x068000, 0x008000, 0x321f034b )
  10437.     ROM_LOAD( "enduro.a36", 0x070000, 0x008000, 0x243e34e5 )
  10438.     ROM_LOAD( "enduro.a44", 0x078000, 0x008000, 0x84bb12a1 )
  10439.  
  10440.     ROM_LOAD( "7674.rom", 0x080000, 0x008000, 0x1a129acf )
  10441.     ROM_LOAD( "7666.rom", 0x088000, 0x008000, 0x23697257 )
  10442.     ROM_LOAD( "7658.rom", 0x090000, 0x008000, 0x1677f24f )
  10443.     ROM_LOAD( "7650.rom", 0x098000, 0x008000, 0x642635ec )
  10444.  
  10445.     ROM_LOAD( "7673.rom", 0x0a0000, 0x008000, 0x82602394 )
  10446.     ROM_LOAD( "7665.rom", 0x0a8000, 0x008000, 0x12d77607 )
  10447.     ROM_LOAD( "7657.rom", 0x0b0000, 0x008000, 0x8158839c )
  10448.     ROM_LOAD( "7649.rom", 0x0b8000, 0x008000, 0x4edba14c )
  10449.  
  10450.     ROM_LOAD( "7672.rom", 0x0c0000, 0x008000, 0xd11452f7 )
  10451.     ROM_LOAD( "7664.rom", 0x0c8000, 0x008000, 0x0df2cfad )
  10452.     ROM_LOAD( "enduro.a39", 0x0d0000, 0x008000, 0x1ff3a5e2 )
  10453.     ROM_LOAD( "7648.rom", 0x0d8000, 0x008000, 0x983ea830 )
  10454.  
  10455.     ROM_LOAD( "7671.rom", 0x0e0000, 0x008000, 0xb0c7fdc6 )
  10456.     ROM_LOAD( "7663.rom", 0x0e8000, 0x008000, 0x2b0b8f08 )
  10457.     ROM_LOAD( "7655.rom", 0x0f0000, 0x008000, 0x3433fe7b )
  10458.     ROM_LOAD( "7647.rom", 0x0f8000, 0x008000, 0x2e7fbec0 )
  10459.  
  10460.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  10461.     ROM_LOAD( "enduro.a16", 0x00000, 0x008000, 0xd2cb6eb5 )
  10462.  
  10463.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* Sega PCM sound data */
  10464.     ROM_LOAD( "7681.rom", 0x00000, 0x008000, 0xbc0c4d12 )
  10465.     ROM_LOAD( "7680.rom", 0x08000, 0x008000, 0x627b3c8c )
  10466.  
  10467.     ROM_REGION( 0x10000, REGION_CPU3 ) /* second 68000 CPU */
  10468.     ROM_LOAD_EVEN("7634.rom", 0x0000, 0x8000, 0x3e07fd32 )
  10469.     ROM_LOAD_ODD ("7635.rom", 0x0000, 0x8000, 0x22f762ab )
  10470.  
  10471.     ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
  10472.     ROM_LOAD( "7633.rom", 0x0000, 0x8000, 0x6f146210 )
  10473. ROM_END
  10474.  
  10475. /***************************************************************************/
  10476.  
  10477. static READ_HANDLER( er_io_analog_r )
  10478. {
  10479.     switch(READ_WORD(&sys16_extraram3[0x30]))
  10480.     {
  10481.         case 0:        // accel
  10482.             if(input_port_1_r( offset ) & 1)
  10483.                 return 0xff;
  10484.             else
  10485.                 return 0;
  10486.         case 4:        // brake
  10487.             if(input_port_1_r( offset ) & 2)
  10488.                 return 0xff;
  10489.             else
  10490.                 return 0;
  10491.         case 8:        // bank up down?
  10492.             if(input_port_1_r( offset ) & 4)
  10493.                 return 0xff;
  10494.             else
  10495.                 return 0;
  10496.         case 12:    // handle
  10497.             return input_port_0_r( offset );
  10498.  
  10499.     }
  10500.     return 0;
  10501. }
  10502.  
  10503. static READ_HANDLER( er_reset2_r )
  10504. {
  10505.     cpu_set_reset_line(2,PULSE_LINE);
  10506.     return 0;
  10507. }
  10508.  
  10509. static struct MemoryReadAddress enduror_readmem[] =
  10510. {
  10511.     { 0x000000, 0x03ffff, MRA_ROM },
  10512.     { 0x040000, 0x043fff, MRA_EXTRAM },
  10513.     { 0x100000, 0x107fff, MRA_TILERAM },
  10514.     { 0x108000, 0x108fff, MRA_TEXTRAM },
  10515.     { 0x110000, 0x110fff, MRA_PALETTERAM },
  10516.  
  10517.     { 0x124000, 0x127fff, shared_ram_r },
  10518.  
  10519.     { 0x130000, 0x130fff, MRA_SPRITERAM },
  10520.  
  10521.     { 0x140010, 0x140011, io_service_r },
  10522.     { 0x140014, 0x140015, io_dip1_r },
  10523.     { 0x140016, 0x140017, io_dip2_r },
  10524.  
  10525.     { 0x140030, 0x140031, er_io_analog_r },
  10526.  
  10527.     { 0x140000, 0x1400ff, MRA_EXTRAM3 },        //io
  10528.     { 0xe00000, 0xe00001, er_reset2_r },
  10529.     {-1}
  10530. };
  10531.  
  10532. static struct MemoryWriteAddress enduror_writemem[] =
  10533. {
  10534.     { 0x000000, 0x03ffff, MWA_ROM },
  10535.     { 0x040000, 0x043fff, MWA_EXTRAM },
  10536.     { 0x100000, 0x107fff, MWA_TILERAM },
  10537.     { 0x108000, 0x108fff, MWA_TEXTRAM },
  10538.     { 0x110000, 0x110fff, MWA_PALETTERAM },
  10539.     { 0x124000, 0x127fff, shared_ram_w, &shared_ram },
  10540.     { 0x130000, 0x130fff, MWA_SPRITERAM },
  10541.     { 0x140000, 0x140001, sound_command_nmi_w },
  10542.     { 0x140000, 0x1400ff, MWA_EXTRAM3 },        //io
  10543.     {-1}
  10544. };
  10545.  
  10546.  
  10547. static READ_HANDLER( enduro_p2_skip_r )
  10548. {
  10549.     if (cpu_get_pc()==0x4ba) {cpu_spinuntil_int(); return 0xffff;}
  10550.  
  10551.     return READ_WORD(&shared_ram[0x2000]);
  10552. }
  10553.  
  10554. static struct MemoryReadAddress enduror_readmem2[] =
  10555. {
  10556.     { 0x000000, 0x03ffff, MRA_ROM },
  10557.     { 0xc68000, 0xc68fff, MRA_EXTRAM2 },
  10558.     { 0xc7e000, 0xc7e001, enduro_p2_skip_r },
  10559.     { 0xc7c000, 0xc7ffff, shared_ram_r },
  10560.     {-1}
  10561. };
  10562.  
  10563. static struct MemoryWriteAddress enduror_writemem2[] =
  10564. {
  10565.     { 0x000000, 0x03ffff, MWA_ROM },
  10566.     { 0xc68000, 0xc68fff, MWA_EXTRAM2 },
  10567.     { 0xc7c000, 0xc7ffff, shared_ram_w, &shared_ram },
  10568.     {-1}
  10569. };
  10570.  
  10571. static struct MemoryReadAddress enduror_sound_readmem[] =
  10572. {
  10573.     { 0x0000, 0x7fff, MRA_ROM },
  10574.     { 0xc000, 0xc7ff, MRA_RAM },
  10575.     { 0xd000, 0xd000, YM2203_status_port_0_r },
  10576.     { 0xe000, 0xe7ff, SegaPCM_r },
  10577.     { -1 }  /* end of table */
  10578. };
  10579.  
  10580. static struct MemoryWriteAddress enduror_sound_writemem[] =
  10581. {
  10582.     { 0x0000, 0x7fff, MWA_ROM },
  10583.     { 0xc000, 0xc7ff, MWA_RAM },
  10584.     { 0xd000, 0xd000, YM2203_control_port_0_w },
  10585.     { 0xd001, 0xd001, YM2203_write_port_0_w },
  10586.     { 0xe000, 0xe7ff, SegaPCM_w },
  10587.     { -1 }  /* end of table */
  10588. };
  10589.  
  10590. static struct IOReadPort enduror_sound_readport[] =
  10591. {
  10592.     { 0x40, 0x40, soundlatch_r },
  10593.     { -1 }    /* end of table */
  10594. };
  10595.  
  10596.  
  10597. static struct IOWritePort enduror_sound_writeport[] =
  10598. {
  10599.     { -1 }
  10600. };
  10601.  
  10602. static struct MemoryReadAddress enduror_b2_sound_readmem[] =
  10603. {
  10604.     { 0x0000, 0x7fff, MRA_ROM },
  10605. //    { 0xc000, 0xc7ff, MRA_RAM },
  10606.     { 0xf000, 0xf7ff, SegaPCM_r },
  10607.     { 0xf800, 0xffff, MRA_RAM },
  10608.     { -1 }  /* end of table */
  10609. };
  10610.  
  10611. static struct MemoryWriteAddress enduror_b2_sound_writemem[] =
  10612. {
  10613.     { 0x0000, 0x7fff, MWA_ROM },
  10614. //    { 0xc000, 0xc7ff, MWA_RAM },
  10615.     { 0xf000, 0xf7ff, SegaPCM_w },
  10616.     { 0xf800, 0xffff, MWA_RAM },
  10617.     { -1 }  /* end of table */
  10618. };
  10619.  
  10620. static struct IOReadPort enduror_b2_sound_readport[] =
  10621. {
  10622.     { 0x00, 0x00, YM2203_status_port_0_r },
  10623.     { 0x80, 0x80, YM2203_status_port_1_r },
  10624.     { 0xc0, 0xc0, YM2203_status_port_2_r },
  10625.     { 0x40, 0x40, soundlatch_r },
  10626.     { -1 }    /* end of table */
  10627. };
  10628.  
  10629. static struct IOWritePort enduror_b2_sound_writeport[] =
  10630. {
  10631.     { 0x00, 0x00, YM2203_control_port_0_w },
  10632.     { 0x01, 0x01, YM2203_write_port_0_w },
  10633.     { 0x80, 0x80, YM2203_control_port_1_w },
  10634.     { 0x81, 0x81, YM2203_write_port_1_w },
  10635.     { 0xc0, 0xc0, YM2203_control_port_2_w },
  10636.     { 0xc1, 0xc1, YM2203_write_port_2_w },
  10637.     { -1 }
  10638. };
  10639.  
  10640. /***************************************************************************/
  10641. static void enduror_update_proc( void ){
  10642.     int data;
  10643.     sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
  10644.     sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
  10645.     sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x01ff;
  10646.     sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
  10647.  
  10648.     data = READ_WORD( &sys16_textram[0x0e9e] );
  10649.  
  10650.     sys16_fg_page[0] = data>>12;
  10651.     sys16_fg_page[1] = (data>>8)&0xf;
  10652.     sys16_fg_page[3] = (data>>4)&0xf;
  10653.     sys16_fg_page[2] = data&0xf;
  10654.  
  10655.     data = READ_WORD( &sys16_textram[0x0e9c] );
  10656.     sys16_bg_page[0] = data>>12;
  10657.     sys16_bg_page[1] = (data>>8)&0xf;
  10658.     sys16_bg_page[3] = (data>>4)&0xf;
  10659.     sys16_bg_page[2] = data&0xf;
  10660.  
  10661.     data = READ_WORD( &sys16_extraram3[2] );
  10662.     set_refresh_3d( data );
  10663.  
  10664.     if(data & 4)
  10665.     {
  10666.         osd_led_w(0,1);
  10667.         osd_led_w(1,1);
  10668.         osd_led_w(2,1);
  10669.     }
  10670.     else
  10671.     {
  10672.         osd_led_w(0,0);
  10673.         osd_led_w(1,0);
  10674.         osd_led_w(2,0);
  10675.     }
  10676. }
  10677.  
  10678.  
  10679. static void enduror_init_machine( void ){
  10680.     static int bank[16] = { 00,01,02,03,04,05,06,07,00,00,00,00,00,00,00,00};
  10681.     sys16_obj_bank = bank;
  10682.     sys16_textmode=1;
  10683.     sys16_spritesystem = 6;
  10684.     sys16_sprxoffset = -0xc0;
  10685.     sys16_fgxoffset = 13;
  10686. //    sys16_sprxoffset = -0xbb;
  10687. //    sys16_fgxoffset = 8;
  10688.     sys16_textlayer_lo_min=0;
  10689.     sys16_textlayer_lo_max=0;
  10690.     sys16_textlayer_hi_min=0;
  10691.     sys16_textlayer_hi_max=0xff;
  10692.  
  10693.     sys16_update_proc = enduror_update_proc;
  10694.  
  10695.     gr_ver = &sys16_extraram2[0x0];
  10696.     gr_hor = gr_ver+0x200;
  10697.     gr_pal = gr_ver+0x400;
  10698.     gr_flip= gr_ver+0x600;
  10699.     gr_palette= 0xf80 / 2;
  10700.     gr_palette_default = 0x70 /2;
  10701.     gr_colorflip[0][0]=0x00 / 2;
  10702.     gr_colorflip[0][1]=0x02 / 2;
  10703.     gr_colorflip[0][2]=0x04 / 2;
  10704.     gr_colorflip[0][3]=0x00 / 2;
  10705.     gr_colorflip[1][0]=0x00 / 2;
  10706.     gr_colorflip[1][1]=0x00 / 2;
  10707.     gr_colorflip[1][2]=0x06 / 2;
  10708.     gr_colorflip[1][3]=0x00 / 2;
  10709.  
  10710.     sys16_sh_shadowpal=0xff;
  10711. }
  10712.  
  10713.  
  10714.  
  10715. static void enduror_sprite_decode( void ){
  10716.     unsigned char *RAM = memory_region(REGION_CPU1);
  10717.     sys16_sprite_decode2( 8,0x020000 ,1);
  10718.     generate_gr_screen(512,1024,8,0,4,0x8000);
  10719.  
  10720. //    enduror_decode_data (RAM,RAM,0x10000);    // no decrypt info.
  10721.     enduror_decode_data (RAM+0x10000,RAM+0x10000,0x10000);
  10722.     enduror_decode_data2(RAM+0x20000,RAM+0x20000,0x10000);
  10723. }
  10724.  
  10725. static void endurob_sprite_decode( void ){
  10726.     sys16_sprite_decode2( 8,0x020000 ,1);
  10727.     generate_gr_screen(512,1024,8,0,4,0x8000);
  10728. }
  10729.  
  10730. static void endurora_opcode_decode( void )
  10731. {
  10732.     unsigned char *rom = memory_region(REGION_CPU1);
  10733.     int diff = 0x50000;    /* place decrypted opcodes in a hole after RAM */
  10734.  
  10735.  
  10736.     memory_set_opcode_base(0,rom+diff);
  10737.  
  10738.     memcpy(rom+diff+0x10000,rom+0x10000,0x20000);
  10739.     memcpy(rom+diff,rom+0x30000,0x10000);
  10740.  
  10741.     // patch code to force a reset on cpu2 when starting a new game.
  10742.     // Undoubtly wrong, but something like it is needed for the game to work
  10743.     WRITE_WORD(&rom[0x1866 + diff],0x4a79);
  10744.     WRITE_WORD(&rom[0x1868 + diff],0x00e0);
  10745.     WRITE_WORD(&rom[0x186a + diff],0x0000);
  10746. }
  10747.  
  10748.  
  10749. static void endurob2_opcode_decode( void )
  10750. {
  10751.     unsigned char *rom = memory_region(REGION_CPU1);
  10752.     int diff = 0x50000;    /* place decrypted opcodes in a hole after RAM */
  10753.  
  10754.  
  10755.     memory_set_opcode_base(0,rom+diff);
  10756.  
  10757.     memcpy(rom+diff,rom,0x30000);
  10758.  
  10759.     endurob2_decode_data (rom,rom+diff,0x10000);
  10760.     endurob2_decode_data2(rom+0x10000,rom+diff+0x10000,0x10000);
  10761.  
  10762.     // patch code to force a reset on cpu2 when starting a new game.
  10763.     // Undoubtly wrong, but something like it is needed for the game to work
  10764.     WRITE_WORD(&rom[0x1866 + diff],0x4a79);
  10765.     WRITE_WORD(&rom[0x1868 + diff],0x00e0);
  10766.     WRITE_WORD(&rom[0x186a + diff],0x0000);
  10767. }
  10768.  
  10769. static void init_enduror( void )
  10770. {
  10771.     sys16_onetime_init_machine();
  10772.     sys16_MaxShadowColors=NumOfShadowColors / 2;
  10773. //    sys16_MaxShadowColors=0;
  10774.  
  10775.     enduror_sprite_decode();
  10776. }
  10777.  
  10778. static void init_endurobl( void )
  10779. {
  10780.     sys16_onetime_init_machine();
  10781.     sys16_MaxShadowColors=NumOfShadowColors / 2;
  10782. //    sys16_MaxShadowColors=0;
  10783.  
  10784.     endurob_sprite_decode();
  10785.     endurora_opcode_decode();
  10786. }
  10787.  
  10788. static void init_endurob2( void )
  10789. {
  10790.     sys16_onetime_init_machine();
  10791.     sys16_MaxShadowColors=NumOfShadowColors / 2;
  10792. //    sys16_MaxShadowColors=0;
  10793.  
  10794.     endurob_sprite_decode();
  10795.     endurob2_opcode_decode();
  10796. }
  10797.  
  10798.  
  10799. /***************************************************************************/
  10800.  
  10801. INPUT_PORTS_START( enduror )
  10802. PORT_START    /* handle right left */
  10803.     PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_X | IPF_REVERSE | IPF_CENTER, 100, 4, 0x0, 0xff )
  10804.  
  10805. PORT_START    /* Fake Buttons */
  10806.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )    // accel
  10807.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )    // brake
  10808.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )    // wheelie
  10809.  
  10810. PORT_START
  10811.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  10812.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  10813.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  10814.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
  10815.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  10816.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  10817.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  10818.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  10819.  
  10820.     SYS16_COINAGE
  10821.  
  10822. PORT_START    /* DSW1 */
  10823.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  10824.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  10825.     PORT_DIPSETTING(    0x01, "Moving" )
  10826.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
  10827.     PORT_DIPSETTING(    0x04, "Easy" )
  10828.     PORT_DIPSETTING(    0x06, "Normal" )
  10829.     PORT_DIPSETTING(    0x02, "Hard" )
  10830.     PORT_DIPSETTING(    0x00, "Hardest" )
  10831.     PORT_DIPNAME( 0x18, 0x18, "Time Adjust" )
  10832.     PORT_DIPSETTING(    0x10, "Easy" )
  10833.     PORT_DIPSETTING(    0x18, "Normal" )
  10834.     PORT_DIPSETTING(    0x08, "Hard" )
  10835.     PORT_DIPSETTING(    0x00, "Hardest" )
  10836.     PORT_DIPNAME( 0x60, 0x60, "Time Control" )
  10837.     PORT_DIPSETTING(    0x40, "Easy" )
  10838.     PORT_DIPSETTING(    0x60, "Normal" )
  10839.     PORT_DIPSETTING(    0x20, "Hard" )
  10840.     PORT_DIPSETTING(    0x00, "Hardest" )
  10841.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  10842.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  10843.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  10844.  
  10845. //PORT_START    /* Y */
  10846. //    PORT_ANALOG( 0xff, 0x0, IPT_AD_STICK_Y | IPF_CENTER , 100, 8, 0x0, 0xff )
  10847.  
  10848. INPUT_PORTS_END
  10849.  
  10850. /***************************************************************************/
  10851.  
  10852. static struct MachineDriver machine_driver_enduror =
  10853. {
  10854.     {
  10855.         {
  10856.             CPU_M68000,
  10857.             10000000,
  10858.             enduror_readmem,enduror_writemem,0,0,
  10859.             sys16_interrupt,1
  10860.         },
  10861.         {
  10862.             CPU_Z80 | CPU_AUDIO_CPU,
  10863.             4096000,
  10864.             enduror_sound_readmem,enduror_sound_writemem,enduror_sound_readport,enduror_sound_writeport,
  10865.             interrupt,4
  10866.         },
  10867.         {
  10868.             CPU_M68000,
  10869.             10000000,
  10870.             enduror_readmem2,enduror_writemem2,0,0,
  10871.             sys16_interrupt,1
  10872.         },
  10873.     },
  10874.     60, DEFAULT_60HZ_VBLANK_DURATION,
  10875.     1,
  10876.     enduror_init_machine,
  10877.     40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
  10878.     gfx8,
  10879.     2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
  10880.     0,
  10881.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  10882.     0,
  10883.     sys16_ho_vh_start,
  10884.     sys16_vh_stop,
  10885.     sys16_ho_vh_screenrefresh,
  10886.     SOUND_SUPPORTS_STEREO,0,0,0,
  10887.     {
  10888.         {
  10889.             SOUND_YM2203,
  10890.             &ym2203_interface
  10891.         },
  10892.         {
  10893.             SOUND_SEGAPCM,
  10894.             &segapcm_interface_32k,
  10895.         }
  10896.     }
  10897. };
  10898.  
  10899. static struct MachineDriver machine_driver_endurob2 =
  10900. {
  10901.     {
  10902.         {
  10903.             CPU_M68000,
  10904.             10000000,
  10905.             enduror_readmem,enduror_writemem,0,0,
  10906.             sys16_interrupt,1
  10907.         },
  10908.         {
  10909.             CPU_Z80 | CPU_AUDIO_CPU,
  10910.             4096000,
  10911.             enduror_b2_sound_readmem,enduror_b2_sound_writemem,enduror_b2_sound_readport,enduror_b2_sound_writeport,
  10912.             ignore_interrupt,1
  10913.         },
  10914.         {
  10915.             CPU_M68000,
  10916.             10000000,
  10917.             enduror_readmem2,enduror_writemem2,0,0,
  10918.             sys16_interrupt,1
  10919.         },
  10920.     },
  10921.     60, DEFAULT_60HZ_VBLANK_DURATION,
  10922.     2,
  10923.     enduror_init_machine,
  10924.     40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
  10925.     gfx8,
  10926.     2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
  10927.     0,
  10928.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  10929.     0,
  10930.     sys16_ho_vh_start,
  10931.     sys16_vh_stop,
  10932.     sys16_ho_vh_screenrefresh,
  10933.     SOUND_SUPPORTS_STEREO,0,0,0,
  10934.     {
  10935.         {
  10936.             SOUND_YM2203,
  10937.             &ym2203_interface2
  10938.         },
  10939.         {
  10940.             SOUND_SEGAPCM,
  10941.             &segapcm_interface_15k,
  10942.         }
  10943.     }
  10944. };
  10945.  
  10946. /*****************************************************************************/
  10947. /* Dummy drivers for games that don't have a working clone and are protected */
  10948. /*****************************************************************************/
  10949.  
  10950. static struct MemoryReadAddress sys16_dummy_readmem[] =
  10951. {
  10952.     { 0x000000, 0x0fffff, MRA_ROM },
  10953.     { 0xff0000, 0xffffff, MRA_WORKINGRAM },
  10954.     {-1}
  10955. };
  10956.  
  10957. static struct MemoryWriteAddress sys16_dummy_writemem[] =
  10958. {
  10959.     { 0x000000, 0x0fffff, MWA_ROM },
  10960.     { 0xff0000, 0xffffff, MWA_WORKINGRAM },
  10961.  
  10962.     {-1}
  10963. };
  10964.  
  10965. static void sys16_dummy_init_machine( void ){
  10966.     static int bank[16] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  10967.     sys16_obj_bank = bank;
  10968. }
  10969.  
  10970. static void init_s16dummy( void )
  10971. {
  10972.     sys16_onetime_init_machine();
  10973. //    sys16_sprite_decode( 4,0x040000 );
  10974. }
  10975.  
  10976. INPUT_PORTS_START( s16dummy )
  10977. INPUT_PORTS_END
  10978.  
  10979. MACHINE_DRIVER( machine_driver_s16dummy, \
  10980.     sys16_dummy_readmem,sys16_dummy_writemem,sys16_dummy_init_machine, gfx8)
  10981.  
  10982. /*****************************************************************************/
  10983. // Ace Attacker
  10984.  
  10985. // sys18
  10986. ROM_START( aceattac )
  10987.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  10988.     ROM_LOAD_EVEN( "11491.4a", 0x000000, 0x10000, 0x77b820f1 )
  10989.     ROM_LOAD_ODD ( "11489.1a", 0x000000, 0x10000, 0xbbe623c5 )
  10990.     ROM_LOAD_EVEN( "11492.5a", 0x020000, 0x10000, 0xd8bd3139 )
  10991.     ROM_LOAD_ODD ( "11490.2a", 0x020000, 0x10000, 0x38cb3a41 )
  10992.  
  10993.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  10994.     ROM_LOAD( "11493.9b",  0x00000, 0x10000, 0x654485d9 )
  10995.     ROM_LOAD( "11494.10b", 0x10000, 0x10000, 0xb67971ab )
  10996.     ROM_LOAD( "11495.11b", 0x20000, 0x10000, 0xb687ab61 )
  10997.  
  10998.     ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
  10999.     ROM_LOAD( "11501.1b", 0x00000, 0x10000, 0x09179ead )
  11000.     ROM_LOAD( "11502.2b", 0x10000, 0x10000, 0xa3ee36b8 )
  11001.     ROM_LOAD( "11503.3b", 0x20000, 0x10000, 0x344c0692 )
  11002.     ROM_LOAD( "11504.4b", 0x30000, 0x10000, 0x7cae7920 )
  11003.     ROM_LOAD( "11505.5b", 0x40000, 0x10000, 0xb67f1ecf )
  11004.     ROM_LOAD( "11506.6b", 0x50000, 0x10000, 0xb0104def )
  11005.     ROM_LOAD( "11507.7b", 0x60000, 0x10000, 0xa2af710a )
  11006.     ROM_LOAD( "11508.8b", 0x70000, 0x10000, 0x5cbb833c )
  11007.  
  11008.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  11009.     ROM_LOAD( "11496.7a",     0x00000, 0x08000, 0x82cb40a9 )
  11010.     ROM_LOAD( "11497.8a",    0x10000, 0x08000, 0xb04f62cc )
  11011.     ROM_LOAD( "11498.9a",    0x18000, 0x08000, 0x97baf52b )
  11012.     ROM_LOAD( "11499.10a",   0x20000, 0x08000, 0xea332866 )
  11013.     ROM_LOAD( "11500.11a",   0x28000, 0x08000, 0x2ddf1c31 )
  11014. ROM_END
  11015.  
  11016. /*****************************************************************************/
  11017. /*****************************************************************************/
  11018. // After Burner
  11019.  
  11020. ROM_START( aburner )
  11021.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11022.     ROM_LOAD( "epr10949.bin",0x000000,0x20000, 0xd8437d92 )
  11023.     ROM_LOAD( "epr10948.bin",0x000000,0x20000, 0x64284761 )
  11024.     ROM_LOAD( "epr10947.bin",0x000000,0x20000, 0x08838392 )
  11025.     ROM_LOAD( "epr10946.bin",0x000000,0x20000, 0xd7d485f4 )
  11026.     ROM_LOAD( "epr10945.bin",0x000000,0x20000, 0xdf4d4c4f )
  11027.     ROM_LOAD( "epr10944.bin",0x000000,0x20000, 0x17be8f67 )
  11028.     ROM_LOAD( "epr10943.bin",0x000000,0x20000, 0xb98294dc )
  11029.     ROM_LOAD( "epr10942.bin",0x000000,0x20000, 0x5ce10b8c )
  11030.     ROM_LOAD( "epr10941.bin",0x000000,0x20000, 0x136ea264 )
  11031.     ROM_LOAD( "epr10940.bin",0x000000,0x20000, 0x4d132c4e )
  11032.     ROM_LOAD( "epr10928.bin",0x000000,0x20000, 0x7c01d40b )
  11033.     ROM_LOAD( "epr10927.bin",0x000000,0x20000, 0x66d36757 )
  11034.     ROM_LOAD( "epr10926.bin",0x000000,0x10000, 0xed8bd632 )
  11035.     ROM_LOAD( "epr10925.bin",0x000000,0x10000, 0x4ef048cc )
  11036.     ROM_LOAD( "epr10924.bin",0x000000,0x10000, 0x50c15a6d )
  11037.     ROM_LOAD( "epr10923.bin",0x000000,0x10000, 0x6888eb8f )
  11038.  
  11039.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11040.  
  11041.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  11042.  
  11043.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  11044.  
  11045.     ROM_REGION( 0x100000, REGION_CPU3 ) /* 2nd 68000 code */
  11046.  
  11047.     ROM_REGION( 0x40000, REGION_GFX3 ) /* gr */
  11048. ROM_END
  11049.  
  11050.  
  11051. /*****************************************************************************/
  11052. // After Burner II
  11053.  
  11054. ROM_START( aburner2 )
  11055.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11056.     ROM_LOAD_EVEN( "11107.58",  0x000000, 0x20000, 0x6d87bab7 )
  11057.     ROM_LOAD_ODD ( "11108.104", 0x000000, 0x20000, 0x202a3e1d )
  11058.  
  11059.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11060.     ROM_LOAD( "11115.154", 0x00000, 0x10000, 0xe8e32921 )
  11061.     ROM_LOAD( "11114.153", 0x10000, 0x10000, 0x2e97f633 )
  11062.     ROM_LOAD( "11113.152", 0x20000, 0x10000, 0x36058c8c )
  11063.  
  11064.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  11065.     ROM_LOAD( "10932.125", 0x000000, 0x20000, 0xcc0821d6 )
  11066.     ROM_LOAD( "10933.126", 0x020000, 0x20000, 0xc8efb2c3 )
  11067.     ROM_LOAD( "10934.129", 0x040000, 0x20000, 0x4a51b1fa )
  11068.     ROM_LOAD( "10935.130", 0x060000, 0x20000, 0xc1e23521 )
  11069.  
  11070.     ROM_LOAD( "10936.133", 0x080000, 0x20000, 0xada70d64 )
  11071.     ROM_LOAD( "10937.134", 0x0a0000, 0x20000, 0x00a6144f )
  11072.     ROM_LOAD( "10938.102", 0x0c0000, 0x20000, 0xe7675baf )
  11073.     ROM_LOAD( "10939.103", 0x0e0000, 0x20000, 0xa0d49480 )
  11074.  
  11075.     ROM_LOAD( "11103.127", 0x100000, 0x20000, 0xbdd60da2 )
  11076.     ROM_LOAD( "11104.131", 0x120000, 0x20000, 0x06a35fce )
  11077.     ROM_LOAD( "11105.135", 0x140000, 0x20000, 0x027b0689 )
  11078.     ROM_LOAD( "11106.104", 0x160000, 0x20000, 0x9e1fec09 )
  11079.  
  11080.     ROM_LOAD( "11116.128", 0x180000, 0x20000, 0x49b4c1ba )
  11081.     ROM_LOAD( "11117.132", 0x1a0000, 0x20000, 0x821fbb71 )
  11082.     ROM_LOAD( "11118.136", 0x1c0000, 0x20000, 0x8f38540b )
  11083.     ROM_LOAD( "11119.105", 0x1e0000, 0x20000, 0xd0343a8e )
  11084.  
  11085.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  11086.     ROM_LOAD( "11112.17",    0x00000, 0x10000, 0xd777fc6d )
  11087.     ROM_LOAD( "11102.13",    0x10000, 0x20000, 0x6c07c78d )
  11088.     ROM_LOAD( "10931.11",    0x30000, 0x20000, 0x9209068f )
  11089.     ROM_LOAD( "10930.12",    0x30000, 0x20000, 0x6493368b )
  11090.  
  11091.     ROM_REGION( 0x100000, REGION_CPU3 ) /* 2nd 68000 code */
  11092.     ROM_LOAD_EVEN( "11109.20", 0x000000, 0x20000, 0x85a0fe07 )
  11093.     ROM_LOAD_ODD ( "11110.29", 0x000000, 0x20000, 0xf3d6797c )
  11094.  
  11095.     ROM_REGION( 0x40000, REGION_GFX3 ) /* gr */
  11096.     ROM_LOAD_ODD ( "10922.40", 0x000000, 0x10000, 0xb49183d4 )
  11097. ROM_END
  11098.  
  11099.  
  11100. /*****************************************************************************/
  11101. // Bloxeed
  11102.  
  11103. // sys18
  11104. ROM_START( bloxeed )
  11105.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11106.     ROM_LOAD_EVEN( "rom-e.rom", 0x000000, 0x20000, 0xa481581a )
  11107.     ROM_LOAD_ODD ( "rom-o.rom", 0x000000, 0x20000, 0xdd1bc3bf )
  11108.  
  11109.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11110.     ROM_LOAD( "scr0.rom", 0x00000, 0x10000, 0xe024aa33 )
  11111.     ROM_LOAD( "scr1.rom", 0x10000, 0x10000, 0x8041b814 )
  11112.     ROM_LOAD( "scr2.rom", 0x20000, 0x10000, 0xde32285e )
  11113.  
  11114.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  11115.     ROM_LOAD( "obj0-e.rom", 0x00000, 0x10000, 0x90d31a8c )
  11116.     ROM_LOAD( "obj0-o.rom", 0x10000, 0x10000, 0xf0c0f49d )
  11117.  
  11118.     ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
  11119.     ROM_LOAD( "sound0.rom",     0x00000, 0x20000, 0x6f2fc63c )
  11120. ROM_END
  11121.  
  11122.  
  11123. /*****************************************************************************/
  11124. // Clutch Hitter
  11125. // sys18
  11126. ROM_START( cltchitr )
  11127.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11128.     ROM_LOAD_EVEN( "epr13795.6a", 0x000000, 0x40000, 0xb0b60b67 )
  11129.     ROM_LOAD_ODD ( "epr13751.4a", 0x000000, 0x40000, 0xc8d80233 )
  11130.     ROM_LOAD_EVEN( "epr13786.7a", 0x080000, 0x40000, 0x3095dac0 )
  11131.     ROM_LOAD_ODD ( "epr13784.5a", 0x080000, 0x40000, 0x80c8180d )
  11132.  
  11133.     ROM_REGION( 0x180000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11134.     ROM_LOAD( "mpr13787.10a", 0x000000, 0x80000, 0xf05c68c6 )
  11135.     ROM_LOAD( "mpr13788.11a", 0x080000, 0x80000, 0x0106fea6 )
  11136.     ROM_LOAD( "mpr13789.12a", 0x100000, 0x80000, 0x09ba8835 )
  11137.  
  11138.     ROM_REGION( 0x300000*2, REGION_GFX2 ) /* sprites */
  11139.     ROM_LOAD( "mpr13773.1c",  0x000000, 0x80000, 0x3fc600e5 )
  11140.     ROM_LOAD( "mpr13774.2c",  0x080000, 0x80000, 0x2411a824 )
  11141.     ROM_LOAD( "mpr13775.3c",  0x100000, 0x80000, 0xcf527bf6 )
  11142.     ROM_LOAD( "mpr13779.10c", 0x180000, 0x80000, 0xc707f416 )
  11143.     ROM_LOAD( "mpr13780.11c", 0x200000, 0x80000, 0xa4c341e0 )
  11144.     ROM_LOAD( "mpr13781.12c", 0x280000, 0x80000, 0xf33b13af )
  11145.  
  11146.     ROM_REGION( 0x180000, REGION_CPU2 ) /* sound CPU */
  11147.     ROM_LOAD( "epr13793.7c",    0x000000, 0x80000, 0xa3d31944 )
  11148.     ROM_LOAD( "epr13791.5c",    0x080000, 0x80000, 0x35c16d80 )
  11149.     ROM_LOAD( "epr13792.6c",    0x100000, 0x80000, 0x808f9695 )
  11150. ROM_END
  11151.  
  11152.  
  11153. /*****************************************************************************/
  11154. // Cotton
  11155.  
  11156. ROM_START( cotton )
  11157.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11158. // custom cpu 317-?????
  11159.     ROM_LOAD_EVEN( "epr13858.a7", 0x000000, 0x20000, 0x276f42fe )
  11160.     ROM_LOAD_ODD ( "epr13856.a5", 0x000000, 0x20000, 0x14e6b5e7 )
  11161.     ROM_LOAD_EVEN( "epr13859.a8", 0x040000, 0x20000, 0x4703ef9d )
  11162.     ROM_LOAD_ODD ( "epr13857.a6", 0x040000, 0x20000, 0xde37e527 )
  11163.  
  11164.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11165.     ROM_LOAD( "scr01.rom", 0x00000, 0x20000, 0xa47354b6 )
  11166.     ROM_LOAD( "scr11.rom", 0x20000, 0x20000, 0xd38424b5 )
  11167.     ROM_LOAD( "scr02.rom", 0x40000, 0x20000, 0x8c990026 )
  11168.     ROM_LOAD( "scr12.rom", 0x60000, 0x20000, 0x21c15b8a )
  11169.     ROM_LOAD( "scr03.rom", 0x80000, 0x20000, 0xd2b175bf )
  11170.     ROM_LOAD( "scr13.rom", 0xa0000, 0x20000, 0xb9d62531 )
  11171.  
  11172.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  11173.     ROM_LOAD( "obj0-e.rom", 0x000000, 0x20000, 0xab4b3468 )
  11174.     ROM_LOAD( "obj0-o.rom", 0x020000, 0x20000, 0x7024f404 )
  11175.     ROM_LOAD( "obj1-e.rom", 0x040000, 0x20000, 0x69b41ac3 )
  11176.     ROM_LOAD( "obj1-o.rom", 0x060000, 0x20000, 0x6169bba4 )
  11177.     ROM_LOAD( "obj2-e.rom", 0x080000, 0x20000, 0x0801cf02 )
  11178.     ROM_LOAD( "obj2-o.rom", 0x0a0000, 0x20000, 0xb014f02d )
  11179.     ROM_LOAD( "obj3-e.rom", 0x0c0000, 0x20000, 0xf066f315 )
  11180.     ROM_LOAD( "obj3-o.rom", 0x0e0000, 0x20000, 0xe62a7cd6 )
  11181.     ROM_LOAD( "obj4-e.rom", 0x100000, 0x20000, 0x1bd145f3 )
  11182.     ROM_LOAD( "obj4-o.rom", 0x120000, 0x20000, 0x943aba8b )
  11183.     ROM_LOAD( "obj5-e.rom", 0x140000, 0x20000, 0x4fd59bff )
  11184.     ROM_LOAD( "obj5-o.rom", 0x160000, 0x20000, 0x7ea93200 )
  11185.     ROM_LOAD( "obj6-e.rom", 0x180000, 0x20000, 0x6a66868d )
  11186.     ROM_LOAD( "obj6-o.rom", 0x1a0000, 0x20000, 0x1c942190 )
  11187.     ROM_LOAD( "obj7-e.rom", 0x1c0000, 0x20000, 0x1c5ffad8 )
  11188.     ROM_LOAD( "obj7-o.rom", 0x1e0000, 0x20000, 0x856f3ee2 )
  11189.  
  11190.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  11191.     ROM_LOAD( "s-prog.rom",     0x00000, 0x08000, 0x6a57b027 )
  11192.     ROM_LOAD( "speech0.rom", 0x10000, 0x20000, 0x4d21153f )
  11193. ROM_END
  11194.  
  11195.  
  11196. ROM_START( cottona )
  11197.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11198. // custom cpu 317-0181a
  11199.     ROM_LOAD_EVEN( "ep13921a.a7", 0x000000, 0x20000, 0xf047a037 )
  11200.     ROM_LOAD_ODD ( "ep13919a.a5", 0x000000, 0x20000, 0x651108b1 )
  11201.     ROM_LOAD_EVEN( "ep13922a.a8", 0x040000, 0x20000, 0x1ca248c5 )
  11202.     ROM_LOAD_ODD ( "ep13920a.a6", 0x040000, 0x20000, 0xfa3610f9 )
  11203.  
  11204.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11205.     ROM_LOAD( "scr01.rom", 0x00000, 0x20000, 0xa47354b6 )
  11206.     ROM_LOAD( "scr11.rom", 0x20000, 0x20000, 0xd38424b5 )
  11207.     ROM_LOAD( "scr02.rom", 0x40000, 0x20000, 0x8c990026 )
  11208.     ROM_LOAD( "scr12.rom", 0x60000, 0x20000, 0x21c15b8a )
  11209.     ROM_LOAD( "scr03.rom", 0x80000, 0x20000, 0xd2b175bf )
  11210.     ROM_LOAD( "scr13.rom", 0xa0000, 0x20000, 0xb9d62531 )
  11211.  
  11212.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  11213.     ROM_LOAD( "obj0-e.rom", 0x000000, 0x20000, 0xab4b3468 )
  11214.     ROM_LOAD( "obj0-o.rom", 0x020000, 0x20000, 0x7024f404 )
  11215.     ROM_LOAD( "obj1-e.rom", 0x040000, 0x20000, 0x69b41ac3 )
  11216.     ROM_LOAD( "obj1-o.rom", 0x060000, 0x20000, 0x6169bba4 )
  11217.     ROM_LOAD( "obj2-e.rom", 0x080000, 0x20000, 0x0801cf02 )
  11218.     ROM_LOAD( "obj2-o.rom", 0x0a0000, 0x20000, 0xb014f02d )
  11219.     ROM_LOAD( "obj3-e.rom", 0x0c0000, 0x20000, 0xf066f315 )
  11220.     ROM_LOAD( "obj3-o.rom", 0x0e0000, 0x20000, 0xe62a7cd6 )
  11221.     ROM_LOAD( "obj4-e.rom", 0x100000, 0x20000, 0x1bd145f3 )
  11222.     ROM_LOAD( "obj4-o.rom", 0x120000, 0x20000, 0x943aba8b )
  11223.     ROM_LOAD( "obj5-e.rom", 0x140000, 0x20000, 0x4fd59bff )
  11224.     ROM_LOAD( "obj5-o.rom", 0x160000, 0x20000, 0x7ea93200 )
  11225.     ROM_LOAD( "obj6-e.rom", 0x180000, 0x20000, 0x6a66868d )
  11226.     ROM_LOAD( "obj6-o.rom", 0x1a0000, 0x20000, 0x1c942190 )
  11227.     ROM_LOAD( "obj7-e.rom", 0x1c0000, 0x20000, 0x1c5ffad8 )
  11228.     ROM_LOAD( "obj7-o.rom", 0x1e0000, 0x20000, 0x856f3ee2 )
  11229.  
  11230.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  11231.     ROM_LOAD( "s-prog.rom",     0x00000, 0x08000, 0x6a57b027 )
  11232.     ROM_LOAD( "speech0.rom", 0x10000, 0x20000, 0x4d21153f )
  11233. ROM_END
  11234.  
  11235.  
  11236. /*****************************************************************************/
  11237. // DD Crew
  11238.  
  11239. ROM_START( ddcrew )
  11240.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11241.     ROM_LOAD_EVEN( "14153.6a", 0x000000, 0x40000, 0xe01fae0c )
  11242.     ROM_LOAD_ODD ( "14152.4a", 0x000000, 0x40000, 0x69c7b571 )
  11243.     ROM_LOAD_EVEN( "14141.7a", 0x080000, 0x40000, 0x080a494b )
  11244.     ROM_LOAD_ODD ( "14139.5a", 0x080000, 0x40000, 0x06c31531 )
  11245.  
  11246.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11247.     ROM_LOAD( "14127.1c", 0x00000, 0x40000, 0x2228cd88 )
  11248.     ROM_LOAD( "14128.2c", 0x40000, 0x40000, 0xedba8e10 )
  11249.     ROM_LOAD( "14129.3c", 0x80000, 0x40000, 0xe8ecc305 )
  11250.  
  11251.     ROM_REGION( 0x400000*2, REGION_GFX2 ) /* sprites */
  11252.     ROM_LOAD( "14134.10c", 0x000000, 0x80000, 0x4fda6a4b )
  11253.     ROM_LOAD( "14142.10a", 0x080000, 0x80000, 0x3cbf1f2a )
  11254.     ROM_LOAD( "14135.11c", 0x100000, 0x80000, 0xe9c74876 )
  11255.     ROM_LOAD( "14143.11a", 0x180000, 0x80000, 0x59022c31 )
  11256.     ROM_LOAD( "14136.12c", 0x200000, 0x80000, 0x720d9858 )
  11257.     ROM_LOAD( "14144.12a", 0x280000, 0x80000, 0x7775fdd4 )
  11258.     ROM_LOAD( "14137.13c", 0x300000, 0x80000, 0x846c4265 )
  11259.     ROM_LOAD( "14145.13a", 0x380000, 0x80000, 0x0e76c797 )
  11260.  
  11261.     ROM_REGION( 0x1a0000, REGION_CPU2 ) /* sound CPU */
  11262.     ROM_LOAD( "14133.7c",     0x000000, 0x20000, 0xcff96665 )
  11263.     ROM_LOAD( "14130.4c",    0x020000, 0x80000, 0x948f34a1 )
  11264.     ROM_LOAD( "14131.5c",    0x0a0000, 0x80000, 0xbe5a7d0b )
  11265.     ROM_LOAD( "14132.6c",    0x120000, 0x80000, 0x1fae0220 )
  11266. ROM_END
  11267.  
  11268.  
  11269. /*****************************************************************************/
  11270. // Dunk Shot
  11271.  
  11272. ROM_START( dunkshot )
  11273.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11274.     ROM_LOAD_EVEN( "10468.bin", 0x000000, 0x8000, 0xe2d5f97a )
  11275.     ROM_LOAD_ODD ( "10467.bin", 0x000000, 0x8000, 0x29774114 )
  11276.     ROM_LOAD_EVEN( "10470.bin", 0x010000, 0x8000, 0x8c60761f )
  11277.     ROM_LOAD_ODD ( "10469.bin", 0x010000, 0x8000, 0xaa442b81 )
  11278.     ROM_LOAD_EVEN( "10472.bin", 0x020000, 0x8000, 0x206027a6 )
  11279.     ROM_LOAD_ODD ( "10471.bin", 0x020000, 0x8000, 0x22777314 )
  11280.  
  11281.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11282.     ROM_LOAD( "10485.bin", 0x00000, 0x8000, 0xf16dda29 )
  11283.     ROM_LOAD( "10486.bin", 0x08000, 0x8000, 0x311d973c )
  11284.     ROM_LOAD( "10487.bin", 0x10000, 0x8000, 0xa8fb179f )
  11285.  
  11286.     ROM_REGION( 0x40000*2, REGION_GFX2 ) /* sprites */
  11287.     ROM_LOAD( "10481.bin", 0x00000, 0x8000, 0xfeb04bc9 )
  11288.     ROM_LOAD( "10477.bin", 0x08000, 0x8000, 0xf9d3b2cb )
  11289.     ROM_LOAD( "10482.bin", 0x10000, 0x8000, 0x5bc07618 )
  11290.     ROM_LOAD( "10478.bin", 0x18000, 0x8000, 0x5b5c5c92 )
  11291.     ROM_LOAD( "10483.bin", 0x20000, 0x8000, 0x7cab4f9e )
  11292.     ROM_LOAD( "10479.bin", 0x28000, 0x8000, 0xe84190a0 )
  11293.     ROM_LOAD( "10484.bin", 0x30000, 0x8000, 0xbcb5fcc9 )
  11294.     ROM_LOAD( "10480.bin", 0x38000, 0x8000, 0x5dffd9dd )
  11295.  
  11296.     ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
  11297.     ROM_LOAD( "10473.bin",     0x00000, 0x08000, 0x7f1f5a27 )
  11298.     ROM_LOAD( "10474.bin",   0x10000, 0x08000, 0x419a656e )
  11299.     ROM_LOAD( "10475.bin",   0x18000, 0x08000, 0x17d55e85 )
  11300.     ROM_LOAD( "10476.bin",   0x20000, 0x08000, 0xa6be0956 )
  11301. ROM_END
  11302.  
  11303.  
  11304.  
  11305. /*****************************************************************************/
  11306. // Laser Ghost
  11307.  
  11308. // sys18
  11309. ROM_START( lghost )
  11310.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11311.     ROM_LOAD_EVEN( "13429", 0x000000, 0x20000, 0x0e0ccf26 )
  11312.     ROM_LOAD_ODD ( "13437", 0x000000, 0x20000, 0x38b4dc2f )
  11313.     ROM_LOAD_EVEN( "13411", 0x040000, 0x20000, 0xc3aeae07 )
  11314.     ROM_LOAD_ODD ( "13413", 0x040000, 0x20000, 0x75f43e21 )
  11315.  
  11316.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11317.     ROM_LOAD( "13414", 0x00000, 0x20000, 0x82025f3b )
  11318.     ROM_LOAD( "13415", 0x20000, 0x20000, 0xa76852e9 )
  11319.     ROM_LOAD( "13416", 0x40000, 0x20000, 0xe88db149 )
  11320.  
  11321.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  11322.     ROM_LOAD( "13603", 0x00000, 0x20000, 0x2e3cc07b )
  11323.     ROM_LOAD( "13604", 0x20000, 0x20000, 0x576388af )
  11324.     ROM_LOAD( "13421", 0x40000, 0x20000, 0xabee8771 )
  11325.     ROM_LOAD( "13424", 0x60000, 0x20000, 0x260ab077 )
  11326.     ROM_LOAD( "13422", 0x80000, 0x20000, 0x36cef12c )
  11327.     ROM_LOAD( "13425", 0xa0000, 0x20000, 0xe0ff8807 )
  11328.     ROM_LOAD( "13423", 0xc0000, 0x20000, 0x5b8e0053 )
  11329.     ROM_LOAD( "13426", 0xe0000, 0x20000, 0xc689853b )
  11330.  
  11331.     ROM_REGION( 0x80000, REGION_CPU2 ) /* sound CPU */
  11332.     ROM_LOAD( "13417",     0x00000, 0x20000, 0xcd7beb49 )
  11333.     ROM_LOAD( "13420",   0x20000, 0x20000, 0x03199cbb )
  11334.     ROM_LOAD( "13419",   0x40000, 0x20000, 0xa918ef68 )
  11335.     ROM_LOAD( "13418",   0x60000, 0x20000, 0x4006c9f1 )
  11336. ROM_END
  11337.  
  11338. /*****************************************************************************/
  11339. // Line of Fire
  11340.  
  11341. ROM_START( loffire )
  11342.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11343.     ROM_LOAD_EVEN( "epr12850.rom", 0x000000, 0x20000, 0x14598f2a )
  11344.     ROM_LOAD_ODD ( "epr12849.rom", 0x000000, 0x20000, 0x61cfd2fe )
  11345.  
  11346.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11347.     ROM_LOAD( "opr12791.rom", 0x00000, 0x10000, 0xacfa69ba )
  11348.     ROM_LOAD( "opr12792.rom", 0x10000, 0x10000, 0xe506723c )
  11349.     ROM_LOAD( "opr12793.rom", 0x20000, 0x10000, 0x0ce8cce3 )
  11350.  
  11351.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  11352.     ROM_LOAD( "epr12775.rom", 0x000000, 0x20000, 0x693056ec )
  11353.     ROM_LOAD( "epr12776.rom", 0x020000, 0x20000, 0x61efbdfd )
  11354.     ROM_LOAD( "epr12777.rom", 0x040000, 0x20000, 0x29d5b953 )
  11355.     ROM_LOAD( "epr12778.rom", 0x060000, 0x20000, 0x2fb68e07 )
  11356.  
  11357.     ROM_LOAD( "epr12779.rom", 0x080000, 0x20000, 0xae58af7c )
  11358.     ROM_LOAD( "epr12780.rom", 0x0a0000, 0x20000, 0xee670c1e )
  11359.     ROM_LOAD( "epr12781.rom", 0x0c0000, 0x20000, 0x538f6bc5 )
  11360.     ROM_LOAD( "epr12782.rom", 0x0e0000, 0x20000, 0x5acc34f7 )
  11361.  
  11362.     ROM_LOAD( "epr12783.rom", 0x100000, 0x20000, 0xc13feea9 )
  11363.     ROM_LOAD( "epr12784.rom", 0x120000, 0x20000, 0x39b94c65 )
  11364.     ROM_LOAD( "epr12785.rom", 0x140000, 0x20000, 0x05ed0059 )
  11365.     ROM_LOAD( "epr12786.rom", 0x160000, 0x20000, 0xa4123165 )
  11366.  
  11367.     ROM_LOAD( "epr12787.rom", 0x180000, 0x20000, 0x6431a3a6 )
  11368.     ROM_LOAD( "epr12788.rom", 0x1a0000, 0x20000, 0x1982a0ce )
  11369.     ROM_LOAD( "epr12789.rom", 0x1c0000, 0x20000, 0x97d03274 )
  11370.     ROM_LOAD( "epr12790.rom", 0x1e0000, 0x20000, 0x816e76e6 )
  11371.  
  11372.     ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
  11373.     ROM_LOAD( "epr12798.rom",     0x00000, 0x10000, 0x0587738d )
  11374.     ROM_LOAD( "epr12799.rom",    0x10000, 0x20000, 0xbc60181c )
  11375.     ROM_LOAD( "epr12800.rom",    0x30000, 0x20000, 0x1158c1a3 )
  11376.     ROM_LOAD( "epr12801.rom",    0x50000, 0x20000, 0x2d6567c4 )
  11377.  
  11378.     ROM_REGION( 0x100000, REGION_CPU3 ) /* 2nd 68000 code */
  11379.     ROM_LOAD_EVEN( "epr12803.rom", 0x000000, 0x20000, 0xc1d9e751 )
  11380.     ROM_LOAD_ODD ( "epr12802.rom", 0x000000, 0x20000, 0xd746bb39 )
  11381.     ROM_LOAD_EVEN( "epr12805.rom", 0x040000, 0x20000, 0x4a7200c3 )
  11382.     ROM_LOAD_ODD ( "epr12804.rom", 0x040000, 0x20000, 0xb853480e )
  11383. ROM_END
  11384.  
  11385.  
  11386. /*****************************************************************************/
  11387. // MVP
  11388.  
  11389. ROM_START( mvp )
  11390.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11391.     ROM_LOAD_EVEN( "13000.rom", 0x000000, 0x40000, 0x2e0e21ec )
  11392.     ROM_LOAD_ODD ( "12999.rom", 0x000000, 0x40000, 0xfd213d28 )
  11393.  
  11394.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11395.     ROM_LOAD( "13011.rom", 0x00000, 0x40000, 0x1cb871fc )
  11396.     ROM_LOAD( "13012.rom", 0x40000, 0x40000, 0xb75e6821 )
  11397.     ROM_LOAD( "13013.rom", 0x80000, 0x40000, 0xf1944a3c )
  11398.  
  11399.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  11400.     ROM_LOAD( "13010.rom", 0x000000, 0x40000, 0xdf37c567 )
  11401.     ROM_LOAD( "13009.rom", 0x040000, 0x40000, 0x126d2e37 )
  11402.     ROM_LOAD( "13006.rom", 0x080000, 0x40000, 0x2e9afd2f )
  11403.     ROM_LOAD( "13003.rom", 0x0c0000, 0x40000, 0x21424151 )
  11404.     ROM_LOAD( "13007.rom", 0x100000, 0x40000, 0x55c8605b )
  11405.     ROM_LOAD( "13004.rom", 0x140000, 0x40000, 0x0aa09dd3 )
  11406.     ROM_LOAD( "13008.rom", 0x180000, 0x40000, 0xb3d46dfc )
  11407.     ROM_LOAD( "13005.rom", 0x1c0000, 0x40000, 0xc899c810 )
  11408.  
  11409.     ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
  11410.     ROM_LOAD( "13002.rom",     0x00000, 0x08000, 0x1b6e1515 )
  11411.     ROM_LOAD( "13001.rom",   0x10000, 0x40000, 0xe8cace8c )
  11412. ROM_END
  11413.  
  11414.  
  11415. /*****************************************************************************/
  11416. // Thunder Blade
  11417.  
  11418. // after burner hardware
  11419. ROM_START( thndrbld )
  11420.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11421.     ROM_LOAD_EVEN( "thnbld.58", 0x000000, 0x20000, 0xe057dd5a )
  11422.     ROM_LOAD_ODD ( "thnbld.63", 0x000000, 0x20000, 0xc6b994b8 )
  11423.     ROM_LOAD_EVEN( "11306.epr", 0x040000, 0x20000, 0x4b95f2b4 )
  11424.     ROM_LOAD_ODD ( "11307.epr", 0x040000, 0x20000, 0x2d6833e4 )
  11425.  
  11426.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11427.     ROM_LOAD( "11316.epr", 0x00000, 0x10000, 0x84290dff )
  11428.     ROM_LOAD( "11315.epr", 0x10000, 0x10000, 0x35813088 )
  11429.     ROM_LOAD( "11314.epr", 0x20000, 0x10000, 0xd4f954a9 )
  11430.  
  11431.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  11432.     ROM_LOAD( "thnbld.105",0x000000, 0x20000, 0xb4a382f7 )
  11433.     ROM_LOAD( "thnbld.101",0x020000, 0x20000, 0x525e2e1d )
  11434.     ROM_LOAD( "thnbld.97", 0x040000, 0x20000, 0x5f2783be )
  11435.     ROM_LOAD( "thnbld.93", 0x060000, 0x20000, 0x90775579 )
  11436.  
  11437.     ROM_LOAD( "11328.epr", 0x080000, 0x20000, 0xda39e89c )
  11438.     ROM_LOAD( "11329.epr", 0x0a0000, 0x20000, 0x31b20257 )
  11439.     ROM_LOAD( "11330.epr", 0x0c0000, 0x20000, 0xaa7c70c5 )
  11440.     ROM_LOAD( "11331.epr", 0x0e0000, 0x20000, 0x3a2c042e )
  11441.  
  11442.     ROM_LOAD( "11324.epr", 0x100000, 0x20000, 0x9742b552 )
  11443.     ROM_LOAD( "11325.epr", 0x120000, 0x20000, 0xb9e98ae9 )
  11444.     ROM_LOAD( "11326.epr", 0x140000, 0x20000, 0x29198403 )
  11445.     ROM_LOAD( "11327.epr", 0x160000, 0x20000, 0xdeae90f1 )
  11446.  
  11447.     ROM_LOAD( "11320.epr", 0x180000, 0x20000, 0xa95c76b8 )
  11448. //    ROM_LOAD( "11321.epr", 0x1a0000, 0x20000, 0x8e738f58 )
  11449.     ROM_LOAD( "thnbld.98", 0x1a0000, 0x10000, 0xeb4b9e57 )
  11450.     ROM_LOAD( "11322.epr", 0x1c0000, 0x20000, 0x10364d74 )
  11451.     ROM_LOAD( "11323.epr", 0x1e0000, 0x20000, 0x27e40735 )
  11452.  
  11453.     ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
  11454.     ROM_LOAD( "thnbld.17",     0x00000, 0x10000, 0xd37b54a4 )
  11455.     ROM_LOAD( "11317.epr",   0x10000, 0x20000, 0xd4e7ac1f )
  11456.     ROM_LOAD( "11318.epr",   0x30000, 0x20000, 0x70d3f02c )
  11457.     ROM_LOAD( "11319.epr",   0x50000, 0x20000, 0x50d9242e )
  11458.  
  11459.     ROM_REGION( 0x100000, REGION_CPU3 ) /* 2nd 68000 code */
  11460.     ROM_LOAD_EVEN( "thnbld.20", 0x000000, 0x20000, 0xed988fdb )
  11461.     ROM_LOAD_ODD ( "thnbld.29", 0x000000, 0x20000, 0x12523bc1 )
  11462.     ROM_LOAD_EVEN( "11310.epr", 0x040000, 0x20000, 0x5d9fa02c )
  11463.     ROM_LOAD_ODD ( "11311.epr", 0x040000, 0x20000, 0x483de21b )
  11464.  
  11465.     ROM_REGION( 0x10000, REGION_GFX3 ) /* ???? */
  11466.     ROM_LOAD( "11313.epr",     0x00000, 0x10000, 0x6a56c4c3 )
  11467. ROM_END
  11468.  
  11469.  
  11470. // Thunder Blade Japan
  11471.  
  11472. // after burner hardware
  11473. ROM_START( thndrbdj )
  11474.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11475.     ROM_LOAD_EVEN( "11304.epr", 0x000000, 0x20000, 0xa90630ef )
  11476.     ROM_LOAD_ODD ( "11305.epr", 0x000000, 0x20000, 0x9ba3ef61 )
  11477.     ROM_LOAD_EVEN( "11306.epr", 0x040000, 0x20000, 0x4b95f2b4 )
  11478.     ROM_LOAD_ODD ( "11307.epr", 0x040000, 0x20000, 0x2d6833e4 )
  11479.  
  11480.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11481.     ROM_LOAD( "11316.epr", 0x00000, 0x10000, 0x84290dff )
  11482.     ROM_LOAD( "11315.epr", 0x10000, 0x10000, 0x35813088 )
  11483.     ROM_LOAD( "11314.epr", 0x20000, 0x10000, 0xd4f954a9 )
  11484.  
  11485.     ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
  11486.     ROM_LOAD( "11332.epr", 0x000000, 0x20000, 0xdc089ec6 )
  11487.     ROM_LOAD( "11333.epr", 0x020000, 0x20000, 0x05a2333f )
  11488.     ROM_LOAD( "11334.epr", 0x040000, 0x20000, 0x348f91c7 )
  11489.     ROM_LOAD( "11335.epr", 0x060000, 0x20000, 0xf19b3e86 )
  11490.  
  11491.     ROM_LOAD( "11328.epr", 0x080000, 0x20000, 0xda39e89c )
  11492.     ROM_LOAD( "11329.epr", 0x0a0000, 0x20000, 0x31b20257 )
  11493.     ROM_LOAD( "11330.epr", 0x0c0000, 0x20000, 0xaa7c70c5 )
  11494.     ROM_LOAD( "11331.epr", 0x0e0000, 0x20000, 0x3a2c042e )
  11495.  
  11496.     ROM_LOAD( "11324.epr", 0x100000, 0x20000, 0x9742b552 )
  11497.     ROM_LOAD( "11325.epr", 0x120000, 0x20000, 0xb9e98ae9 )
  11498.     ROM_LOAD( "11326.epr", 0x140000, 0x20000, 0x29198403 )
  11499.     ROM_LOAD( "11327.epr", 0x160000, 0x20000, 0xdeae90f1 )
  11500.  
  11501.     ROM_LOAD( "11320.epr", 0x180000, 0x20000, 0xa95c76b8 )
  11502.     ROM_LOAD( "11321.epr", 0x1a0000, 0x20000, 0x8e738f58 )
  11503.     ROM_LOAD( "11322.epr", 0x1c0000, 0x20000, 0x10364d74 )
  11504.     ROM_LOAD( "11323.epr", 0x1e0000, 0x20000, 0x27e40735 )
  11505.  
  11506.     ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
  11507.     ROM_LOAD( "11312.epr",   0x00000, 0x10000, 0x3b974ed2 )
  11508.     ROM_LOAD( "11317.epr",   0x10000, 0x20000, 0xd4e7ac1f )
  11509.     ROM_LOAD( "11318.epr",   0x30000, 0x20000, 0x70d3f02c )
  11510.     ROM_LOAD( "11319.epr",   0x50000, 0x20000, 0x50d9242e )
  11511.  
  11512.     ROM_REGION( 0x100000, REGION_CPU3 ) /* 2nd 68000 code */
  11513.     ROM_LOAD_EVEN( "11308.epr", 0x000000, 0x20000, 0x7956c238 )
  11514.     ROM_LOAD_ODD ( "11309.epr", 0x000000, 0x20000, 0xc887f620 )
  11515.     ROM_LOAD_EVEN( "11310.epr", 0x040000, 0x20000, 0x5d9fa02c )
  11516.     ROM_LOAD_ODD ( "11311.epr", 0x040000, 0x20000, 0x483de21b )
  11517.  
  11518.     ROM_REGION( 0x10000, REGION_GFX3 ) /* ???? */
  11519.     ROM_LOAD( "11313.epr",     0x00000, 0x10000, 0x6a56c4c3 )
  11520. ROM_END
  11521.  
  11522.  
  11523. /*****************************************************************************/
  11524. // Turbo Outrun
  11525.  
  11526. ROM_START( toutrun )
  11527.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11528. // custom cpu 317-0106
  11529.     ROM_LOAD_EVEN( "epr12397.133", 0x000000, 0x10000, 0xe4b57d7d )
  11530.     ROM_LOAD_ODD ( "epr12396.118", 0x000000, 0x10000, 0x5e7115cb )
  11531.     ROM_LOAD_EVEN( "epr12399.132", 0x020000, 0x10000, 0x62c77b1b )
  11532.     ROM_LOAD_ODD ( "epr12398.117", 0x020000, 0x10000, 0x18e34520 )
  11533.     ROM_LOAD_EVEN( "epr12293.131", 0x040000, 0x10000, 0xf4321eea )
  11534.     ROM_LOAD_ODD ( "epr12292.116", 0x040000, 0x10000, 0x51d98af0 )
  11535.  
  11536.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11537.     ROM_LOAD( "opr12323.102", 0x00000, 0x10000, 0x4de43a6f )
  11538.     ROM_LOAD( "opr12324.103", 0x10000, 0x10000, 0x24607a55 )
  11539.     ROM_LOAD( "opr12325.104", 0x20000, 0x10000, 0x1405137a )
  11540.  
  11541.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  11542.     ROM_LOAD( "opr12307.9",  0x00000, 0x10000, 0x437dcf09 )
  11543.     ROM_LOAD( "opr12308.10", 0x10000, 0x10000, 0x0de70cc2 )
  11544.     ROM_LOAD( "opr12309.11", 0x20000, 0x10000, 0xdeb8c242 )
  11545.     ROM_LOAD( "opr12310.12", 0x30000, 0x10000, 0x45cf157e )
  11546.  
  11547.     ROM_LOAD( "opr12311.13", 0x40000, 0x10000, 0xae2bd639 )
  11548.     ROM_LOAD( "opr12312.14", 0x50000, 0x10000, 0x626000e7 )
  11549.     ROM_LOAD( "opr12313.15", 0x60000, 0x10000, 0x52870c37 )
  11550.     ROM_LOAD( "opr12314.16", 0x70000, 0x10000, 0x40c461ea )
  11551.  
  11552.     ROM_LOAD( "opr12315.17", 0x80000, 0x10000, 0x3ff9a3a3 )
  11553.     ROM_LOAD( "opr12316.18", 0x90000, 0x10000, 0x8a1e6dc8 )
  11554.     ROM_LOAD( "opr12317.19", 0xa0000, 0x10000, 0x77e382d4 )
  11555.     ROM_LOAD( "opr12318.20", 0xb0000, 0x10000, 0xd1afdea9 )
  11556.  
  11557.     ROM_LOAD( "opr12320.22", 0xc0000, 0x10000, 0x7931e446 )
  11558.     ROM_LOAD( "opr12321.23", 0xd0000, 0x10000, 0x830bacd4 )
  11559.     ROM_LOAD( "opr12322.24", 0xe0000, 0x10000, 0x8b812492 )
  11560.     ROM_LOAD( "opr12319.25", 0xf0000, 0x10000, 0xdf23baf9 )
  11561.  
  11562.     ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
  11563.     ROM_LOAD( "epr12300.88",    0x00000, 0x10000, 0xe8ff7011 )
  11564.     ROM_LOAD( "opr12301.66",    0x10000, 0x10000, 0x6e78ad15 )
  11565.     ROM_LOAD( "opr12302.67",    0x20000, 0x10000, 0xe72928af )
  11566.     ROM_LOAD( "opr12303.68",    0x30000, 0x10000, 0x8384205c )
  11567.     ROM_LOAD( "opr12304.69",    0x40000, 0x10000, 0xe1762ac3 )
  11568.     ROM_LOAD( "opr12305.70",    0x50000, 0x10000, 0xba9ce677 )
  11569.     ROM_LOAD( "opr12306.71",    0x60000, 0x10000, 0xe49249fd )
  11570.  
  11571.     ROM_REGION( 0x100000, REGION_CPU3 ) /* 68000 code */
  11572.     ROM_LOAD_EVEN( "opr12295.76", 0x000000, 0x10000, 0xd43a3a84 )
  11573.     ROM_LOAD_ODD ( "opr12294.58", 0x000000, 0x10000, 0x27cdcfd3 )
  11574.     ROM_LOAD_EVEN( "opr12297.75", 0x020000, 0x10000, 0x1d9b5677 )
  11575.     ROM_LOAD_ODD ( "opr12296.57", 0x020000, 0x10000, 0x0a513671 )
  11576.  
  11577.     ROM_REGION( 0x40000, REGION_GFX3 ) /* road */
  11578.     ROM_LOAD_ODD ( "epr12298.11", 0x000000, 0x08000, 0xfc9bc41b )
  11579. ROM_END
  11580.  
  11581.  
  11582. ROM_START( toutruna )
  11583.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11584. // custom cpu 317-0106
  11585.     ROM_LOAD_EVEN( "epr12410.133", 0x000000, 0x10000, 0xaa74f3e9 )
  11586.     ROM_LOAD_ODD ( "epr12409.118", 0x000000, 0x10000, 0xc11c8ef7 )
  11587.     ROM_LOAD_EVEN( "epr12412.132", 0x020000, 0x10000, 0xb0534647 )
  11588.     ROM_LOAD_ODD ( "epr12411.117", 0x020000, 0x10000, 0x12bb0d83 )
  11589.     ROM_LOAD_EVEN( "epr12293.131", 0x040000, 0x10000, 0xf4321eea )
  11590.     ROM_LOAD_ODD ( "epr12292.116", 0x040000, 0x10000, 0x51d98af0 )
  11591.  
  11592.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11593.     ROM_LOAD( "opr12323.102", 0x00000, 0x10000, 0x4de43a6f )
  11594.     ROM_LOAD( "opr12324.103", 0x10000, 0x10000, 0x24607a55 )
  11595.     ROM_LOAD( "opr12325.104", 0x20000, 0x10000, 0x1405137a )
  11596.  
  11597.     ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
  11598.     ROM_LOAD( "opr12307.9",  0x00000, 0x10000, 0x437dcf09 )
  11599.     ROM_LOAD( "opr12308.10", 0x10000, 0x10000, 0x0de70cc2 )
  11600.     ROM_LOAD( "opr12309.11", 0x20000, 0x10000, 0xdeb8c242 )
  11601.     ROM_LOAD( "opr12310.12", 0x30000, 0x10000, 0x45cf157e )
  11602.  
  11603.     ROM_LOAD( "opr12311.13", 0x40000, 0x10000, 0xae2bd639 )
  11604.     ROM_LOAD( "opr12312.14", 0x50000, 0x10000, 0x626000e7 )
  11605.     ROM_LOAD( "opr12313.15", 0x60000, 0x10000, 0x52870c37 )
  11606.     ROM_LOAD( "opr12314.16", 0x70000, 0x10000, 0x40c461ea )
  11607.  
  11608.     ROM_LOAD( "opr12315.17", 0x80000, 0x10000, 0x3ff9a3a3 )
  11609.     ROM_LOAD( "opr12316.18", 0x90000, 0x10000, 0x8a1e6dc8 )
  11610.     ROM_LOAD( "opr12317.19", 0xa0000, 0x10000, 0x77e382d4 )
  11611.     ROM_LOAD( "opr12318.20", 0xb0000, 0x10000, 0xd1afdea9 )
  11612.  
  11613.     ROM_LOAD( "opr12320.22", 0xc0000, 0x10000, 0x7931e446 )
  11614.     ROM_LOAD( "opr12321.23", 0xd0000, 0x10000, 0x830bacd4 )
  11615.     ROM_LOAD( "opr12322.24", 0xe0000, 0x10000, 0x8b812492 )
  11616.     ROM_LOAD( "opr12319.25", 0xf0000, 0x10000, 0xdf23baf9 )
  11617.  
  11618.     ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
  11619.     ROM_LOAD( "epr12300.88",    0x00000, 0x10000, 0xe8ff7011 )
  11620.     ROM_LOAD( "opr12301.66",    0x10000, 0x10000, 0x6e78ad15 )
  11621.     ROM_LOAD( "opr12302.67",    0x20000, 0x10000, 0xe72928af )
  11622.     ROM_LOAD( "opr12303.68",    0x30000, 0x10000, 0x8384205c )
  11623.     ROM_LOAD( "opr12304.69",    0x40000, 0x10000, 0xe1762ac3 )
  11624.     ROM_LOAD( "opr12305.70",    0x50000, 0x10000, 0xba9ce677 )
  11625.     ROM_LOAD( "opr12306.71",    0x60000, 0x10000, 0xe49249fd )
  11626.  
  11627.     ROM_REGION( 0x100000, REGION_CPU3 ) /* 68000 code */
  11628.     ROM_LOAD_EVEN( "opr12295.76", 0x000000, 0x10000, 0xd43a3a84 )
  11629.     ROM_LOAD_ODD ( "opr12294.58", 0x000000, 0x10000, 0x27cdcfd3 )
  11630.     ROM_LOAD_EVEN( "opr12297.75", 0x020000, 0x10000, 0x1d9b5677 )
  11631.     ROM_LOAD_ODD ( "opr12296.57", 0x020000, 0x10000, 0x0a513671 )
  11632.  
  11633.     ROM_REGION( 0x40000, REGION_GFX3 ) /* road */
  11634.     ROM_LOAD_ODD ( "epr12298.11", 0x000000, 0x08000, 0xfc9bc41b )
  11635. ROM_END
  11636.  
  11637.  
  11638. /*****************************************************************************/
  11639. // Excite League
  11640.  
  11641. ROM_START( exctleag )
  11642.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11643.     ROM_LOAD_EVEN( "epr11937.a02",0x00000,0x10000, 0x4ebda367 )
  11644.     ROM_LOAD_ODD ( "epr11936.a01",0x00000,0x10000, 0x0863de60 )
  11645.     ROM_LOAD_EVEN( "epr11939.a04",0x20000,0x10000, 0x117dd98f )
  11646.     ROM_LOAD_ODD ( "epr11938.a03",0x20000,0x10000, 0x07c08d47 )
  11647.     ROM_LOAD_EVEN( "epr11941.a06",0x40000,0x10000, 0x4df2d451 )
  11648.     ROM_LOAD_ODD ( "epr11940.a05",0x40000,0x10000, 0xdec83274 )
  11649.  
  11650.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11651.     ROM_LOAD( "epr11942.b09",0x00000,0x10000, 0xeb70e827 )
  11652.     ROM_LOAD( "epr11943.b10",0x10000,0x10000, 0xd97c8982 )
  11653.     ROM_LOAD( "epr11944.b11",0x20000,0x10000, 0xa75cae80 )
  11654.  
  11655.     ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
  11656.     ROM_LOAD( "epr11950.b01",0x00000,0x10000, 0xaf497849 )
  11657.     ROM_LOAD( "epr11951.b02",0x10000,0x10000, 0xc04fa974 )
  11658.     ROM_LOAD( "epr11952.b03",0x20000,0x10000, 0xe64a9761 )
  11659.     ROM_LOAD( "epr11953.b04",0x30000,0x10000, 0x4cae3999 )
  11660.     ROM_LOAD( "epr11954.b05",0x40000,0x10000, 0x5fa2106c )
  11661.     ROM_LOAD( "epr11955.b06",0x50000,0x10000, 0x86a0c368 )
  11662.     ROM_LOAD( "epr11956.b07",0x60000,0x10000, 0xaff5c2fa )
  11663.     ROM_LOAD( "epr11957.b08",0x70000,0x10000, 0x218f835b )
  11664.  
  11665.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  11666.     ROM_LOAD( "epr11945.a07",0x00000,0x8000, 0xc2a83012 )
  11667.     ROM_LOAD( "epr11140.a08",0x10000,0x8000, 0xb297371b )
  11668.     ROM_LOAD( "epr11141.a09",0x18000,0x8000, 0x19756aa6 )
  11669.     ROM_LOAD( "epr11142.a10",0x20000,0x8000, 0x25d26c66 )
  11670.     ROM_LOAD( "epr11143.a11",0x28000,0x8000, 0x848b7b77 )
  11671.  
  11672. ROM_END
  11673.  
  11674.  
  11675.  
  11676. /*****************************************************************************/
  11677. // Super League
  11678.  
  11679. ROM_START( suprleag )
  11680.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11681.     ROM_LOAD_EVEN( "epr11131.a02",0x00000,0x10000, 0x9b78c2cc )
  11682.     ROM_LOAD_ODD ( "epr11130.a01",0x00000,0x10000, 0xe2451676 )
  11683.     ROM_LOAD_EVEN( "epr11133.a04",0x20000,0x10000, 0xeed72f37 )
  11684.     ROM_LOAD_ODD ( "epr11132.a03",0x20000,0x10000, 0xff199325 )
  11685.     ROM_LOAD_EVEN( "epr11135.a06",0x40000,0x10000, 0x3735e0e1 )
  11686.     ROM_LOAD_ODD ( "epr11134.a05",0x40000,0x10000, 0xccd857f5 )
  11687.  
  11688.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11689.     ROM_LOAD( "epr11136.b09",0x00000,0x10000, 0xc3860ce4 )
  11690.     ROM_LOAD( "epr11137.b10",0x10000,0x10000, 0x92d96187 )
  11691.     ROM_LOAD( "epr11138.b11",0x20000,0x10000, 0xc01dc773 )
  11692.  
  11693.     ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
  11694.     ROM_LOAD( "epr11144.b01",0x00000,0x10000, 0xb31de51c )
  11695.     ROM_LOAD( "epr11145.b02",0x10000,0x10000, 0x4223d2c3 )
  11696.     ROM_LOAD( "epr11146.b03",0x20000,0x10000, 0xbf0359b6 )
  11697.     ROM_LOAD( "epr11147.b04",0x30000,0x10000, 0x3e592772 )
  11698.     ROM_LOAD( "epr11148.b05",0x40000,0x10000, 0x126e1309 )
  11699.     ROM_LOAD( "epr11149.b06",0x50000,0x10000, 0x694d3765 )
  11700.     ROM_LOAD( "epr11150.b07",0x60000,0x10000, 0x9fc0aded )
  11701.     ROM_LOAD( "epr11151.b08",0x70000,0x10000, 0x9de95169 )
  11702.  
  11703.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  11704.     ROM_LOAD( "epr11139.a07",0x00000,0x08000, 0x9cbd99da )
  11705.     ROM_LOAD( "epr11140.a08",0x10000,0x08000, 0xb297371b )
  11706.     ROM_LOAD( "epr11141.a09",0x18000,0x08000, 0x19756aa6 )
  11707.     ROM_LOAD( "epr11142.a10",0x20000,0x08000, 0x25d26c66 )
  11708.     ROM_LOAD( "epr11143.a11",0x28000,0x08000, 0x848b7b77 )
  11709.  
  11710. ROM_END
  11711.  
  11712. /*****************************************************************************/
  11713. // Action Fighter
  11714.  
  11715. ROM_START( afighter )
  11716.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11717. // cpu 317-0018
  11718.     ROM_LOAD_EVEN( "10348",0x00000,0x08000, 0xe51e3012 )
  11719.     ROM_LOAD_ODD ( "10349",0x00000,0x08000, 0x4b434c37 )
  11720.     ROM_LOAD_EVEN( "10350",0x20000,0x08000, 0xf2cd6b3f )
  11721.     ROM_LOAD_ODD ( "10351",0x20000,0x08000, 0xede21d8d )
  11722.     ROM_LOAD_EVEN( "10352",0x40000,0x08000, 0xf8abb143 )
  11723.     ROM_LOAD_ODD ( "10353",0x40000,0x08000, 0x5a757dc9 )
  11724.  
  11725.     ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11726.     ROM_LOAD( "10281",0x00000,0x10000, 0x30e92cda )
  11727.     ROM_LOAD( "10282",0x10000,0x10000, 0xb67b8910 )
  11728.     ROM_LOAD( "10283",0x20000,0x10000, 0xe7dbfd2d )
  11729.  
  11730.     ROM_REGION( 0x40000*2, REGION_GFX2 ) /* sprites */
  11731.     ROM_LOAD( "10285",0x00000,0x08000, 0x98aa3d04 )
  11732.     ROM_LOAD( "10286",0x08000,0x08000, 0x8da050cf )
  11733.     ROM_LOAD( "10287",0x10000,0x08000, 0x7989b74a )
  11734.     ROM_LOAD( "10288",0x18000,0x08000, 0xd3ce551a )
  11735.     ROM_LOAD( "10289",0x20000,0x08000, 0xc59d1b98 )
  11736.     ROM_LOAD( "10290",0x28000,0x08000, 0x39354223 )
  11737.     ROM_LOAD( "10291",0x30000,0x08000, 0x6e4b245c )
  11738.     ROM_LOAD( "10292",0x38000,0x08000, 0xcef289a3 )
  11739.  
  11740.     ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
  11741.     ROM_LOAD( "10284",0x00000,0x8000, 0x8ff09116 )
  11742.  
  11743. ROM_END
  11744.  
  11745. /*****************************************************************************/
  11746. // Ryukyu
  11747.  
  11748. ROM_START( ryukyu )
  11749.     ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
  11750. // cpu 317-5023
  11751.     ROM_LOAD_EVEN( "13347",0x00000,0x10000, 0x398031fa )
  11752.     ROM_LOAD_ODD ( "13348",0x00000,0x10000, 0x5f0e0c86 )
  11753.  
  11754.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
  11755.     ROM_LOAD( "13351",0x00000,0x20000, 0xa68a4e6d )
  11756.     ROM_LOAD( "13352",0x20000,0x20000, 0x5e5531e4 )
  11757.     ROM_LOAD( "13353",0x40000,0x20000, 0x6d23dfd8 )
  11758.  
  11759.     ROM_REGION( 0x40000*2, REGION_GFX2 ) /* sprites */
  11760.     ROM_LOAD( "13354",0x00000,0x20000, 0xf07aad99 )
  11761.     ROM_LOAD( "13355",0x20000,0x20000, 0x67890019 )
  11762.     ROM_LOAD( "13356",0x30000,0x20000, 0x5498290b )
  11763.     ROM_LOAD( "13357",0x40000,0x20000, 0xf9e7cf03 )
  11764.  
  11765.     ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
  11766.     ROM_LOAD( "13349",0x00000,0x08000, 0xb83183f8 )
  11767.     ROM_LOAD( "13350",0x10000,0x20000, 0x3c59a658 )
  11768.  
  11769. ROM_END
  11770.  
  11771.  
  11772.  
  11773. /***************************************************************************/
  11774.  
  11775. GAMEX(1986, alexkidd, 0,        alexkidd, alexkidd, alexkidd, ROT0,         "Sega",    "Alex Kidd (set 1)", GAME_NOT_WORKING)
  11776. GAME( 1986, alexkida, alexkidd, alexkidd, alexkidd, alexkidd, ROT0,         "Sega",    "Alex Kidd (set 2)")
  11777. GAME( 1987, aliensyn, 0,        aliensyn, aliensyn, aliensyn, ROT0,         "Sega",    "Alien Syndrome (set 1)")
  11778. GAMEX(1987, aliensya, aliensyn, aliensyn, aliensyn, aliensyn, ROT0,         "Sega",    "Alien Syndrome (set 2)", GAME_NOT_WORKING)
  11779. GAMEX(1987, aliensyj, aliensyn, aliensyn, aliensyn, aliensyn, ROT0,         "Sega",    "Alien Syndrome (Japan)", GAME_NOT_WORKING)
  11780. GAMEX(1987, aliensyb, aliensyn, aliensyn, aliensyn, aliensyn, ROT0,         "Sega",    "Alien Syndrome (set 3)", GAME_NOT_WORKING)
  11781. GAME( 1988, altbeast, 0,        altbeast, altbeast, altbeast, ROT0,         "Sega",    "Altered Beast (Version 1)")
  11782. GAMEX(1988, jyuohki,  altbeast, altbeast, altbeast, altbeast, ROT0,         "Sega",    "Jyuohki (Japan)",           GAME_NOT_WORKING)
  11783. GAMEX(1988, altbeas2, altbeast, altbeas2, altbeast, altbeast, ROT0,         "Sega",    "Altered Beast (Version 2)", GAME_NO_SOUND)
  11784. GAMEX(1990, astorm,   0,        astorm,   astorm,   astorm,   ROT0_16BIT,   "Sega",    "Alien Storm", GAME_NOT_WORKING)
  11785. GAMEX(1990, astorm2p, astorm,   astorm,   astorm,   astorm,   ROT0_16BIT,   "Sega",    "Alien Storm (2 Player)", GAME_NOT_WORKING)
  11786. GAME( 1990, astormbl, astorm,   astorm,   astorm,   astorm,   ROT0_16BIT,   "bootleg", "Alien Storm (bootleg)")
  11787. GAMEX(1990, atomicp,  0,        atomicp,  atomicp,  atomicp,  ROT0,         "Philko",  "Atomic Point", GAME_NO_SOUND)
  11788. GAME( 1990, aurail,   0,        aurail,   aurail,   aurail,   ROT0,         "Sega / Westone", "Aurail (set 1)")
  11789. GAME( 1990, auraila,  aurail,   aurail,   aurail,   auraila,  ROT0,         "Sega / Westone", "Aurail (set 2)")
  11790. GAME( 1989, bayroute, 0,        bayroute, bayroute, bayroute, ROT0,         "Sunsoft / Sega", "Bay Route (set 1)")
  11791. GAMEX(1989, bayrouta, bayroute, bayroute, bayroute, bayrouta, ROT0,         "Sunsoft / Sega", "Bay Route (set 2)", GAME_NOT_WORKING)
  11792. GAMEX(1989, bayrtbl1, bayroute, bayroute, bayroute, bayrtbl1, ROT0,         "bootleg", "Bay Route (bootleg set 1)", GAME_NOT_WORKING)
  11793. GAMEX(1989, bayrtbl2, bayroute, bayroute, bayroute, bayrtbl1, ROT0,         "bootleg", "Bay Route (bootleg set 2)", GAME_NOT_WORKING)
  11794. GAME( 1986, bodyslam, 0,        bodyslam, bodyslam, bodyslam, ROT0,         "Sega",    "Body Slam")
  11795. GAME( 1986, dumpmtmt, bodyslam, bodyslam, bodyslam, bodyslam, ROT0,         "Sega",    "Dump Matsumoto (Japan)")
  11796. GAME( 1989, dduxbl,   0,        dduxbl,   dduxbl,   dduxbl,   ROT0,         "bootleg", "Dynamite Dux (bootleg)")
  11797. GAMEX(1989, eswat,    0,        eswat,    eswat,    eswat,    ROT0,         "Sega",    "E-Swat", GAME_NOT_WORKING)
  11798. GAME( 1989, eswatbl,  eswat,    eswat,    eswat,    eswat,    ROT0,         "bootleg", "E-Swat (bootleg)")
  11799. GAME( 1986, fantzone, 0,        fantzone, fantzone, fantzone, ROT0,         "Sega",    "Fantasy Zone (Japan New Ver.)")
  11800. GAME( 1986, fantzono, fantzone, fantzono, fantzone, fantzone, ROT0,         "Sega",    "Fantasy Zone (Old Ver.)")
  11801. GAMEX(1989, fpoint,   0,        fpoint,   fpoint,   fpoint,   ROT0,         "Sega",    "Flash Point", GAME_NOT_WORKING)
  11802. GAME( 1989, fpointbl, fpoint,   fpoint,   fpoint,   fpointbl, ROT0,         "bootleg", "Flash Point (bootleg)")
  11803. GAME( 1989, goldnaxe, 0,        goldnaxe, goldnaxe, goldnaxe, ROT0,         "Sega",    "Golden Axe (Version 1)")
  11804. GAMEX(1989, goldnaxj, goldnaxe, goldnaxe, goldnaxe, goldnaxe, ROT0,         "Sega",    "Golden Axe (Version 1, Japan)", GAME_NOT_WORKING)
  11805. GAMEX(1989, goldnabl, goldnaxe, goldnaxe, goldnaxe, goldnabl, ROT0,         "bootleg", "Golden Axe (bootleg)", GAME_NOT_WORKING)
  11806. GAME( 1989, goldnaxa, goldnaxe, goldnaxa, goldnaxe, goldnaxe, ROT0,         "Sega",    "Golden Axe (Version 2)")
  11807. GAMEX(1989, goldnaxb, goldnaxe, goldnaxa, goldnaxe, goldnaxe, ROT0,         "Sega",    "Golden Axe (Version 2 317-0110)", GAME_NOT_WORKING)
  11808. GAMEX(1989, goldnaxc, goldnaxe, goldnaxa, goldnaxe, goldnaxe, ROT0,         "Sega",    "Golden Axe (Version 2 317-0122)", GAME_NOT_WORKING)
  11809. GAME( 1987, hwchamp,  0,        hwchamp,  hwchamp,  hwchamp,  ROT0,         "Sega",    "Heavyweight Champ")
  11810. GAME( 1985, mjleague, 0,        mjleague, mjleague, mjleague, ROT270,       "Sega",    "Major League")
  11811. GAMEX(1990, moonwalk, 0,        moonwalk, moonwalk, moonwalk, ROT0,         "Sega",    "Moon Walker (Set 1)", GAME_NOT_WORKING)
  11812. GAMEX(1990, moonwlka, moonwalk, moonwalk, moonwalk, moonwalk, ROT0,         "Sega",    "Moon Walker (Set 2)", GAME_NOT_WORKING)
  11813. GAME( 1990, moonwlkb, moonwalk, moonwalk, moonwalk, moonwalk, ROT0,         "bootleg", "Moon Walker (bootleg)")
  11814. GAMEX(????, passsht,  0,        passsht,  passsht,  passsht,  ROT270,       "Sega",    "Passing Shot (2 Players)", GAME_NOT_WORKING)
  11815. GAME( ????, passshtb, passsht,  passsht,  passsht,  passsht,  ROT270,       "bootleg", "Passing Shot (2 Players) (bootleg)")
  11816. GAMEX(????, passht4b, passsht,  passht4b, passht4b, passht4b, ROT270,       "bootleg", "Passing Shot (4 Players) (bootleg)", GAME_NO_SOUND)
  11817. GAME( 1986, quartet,  0,        quartet,  quartet,  quartet,  ROT0,         "Sega",    "Quartet")
  11818. GAME( 1986, quartetj, quartet,  quartet,  quartet,  quartet,  ROT0,         "Sega",    "Quartet (Japan)")
  11819. GAME( 1986, quartet2, quartet,  quartet2, quartet2, quartet2, ROT0,         "Sega",    "Quartet II")
  11820. GAME( 1991, riotcity, 0,        riotcity, riotcity, riotcity, ROT0,         "Sega / Westone", "Riot City")
  11821. GAME( 1987, sdi,      0,        sdi,      sdi,      sdi,      ROT0,         "Sega",    "SDI - Strategic Defense Initiative")
  11822. GAMEX(1987, sdioj,    sdi,      sdi,      sdi,      sdi,      ROT0,         "Sega",    "SDI - Strategic Defense Initiative (Japan)", GAME_NOT_WORKING)
  11823. GAME( 1989, shdancer, 0,        shdancer, shdancer, shdancer, ROT0,         "Sega",    "Shadow Dancer (US)")
  11824. GAMEX(1989, shdancbl, shdancer, shdancbl, shdancer, shdancbl, ROT0,         "bootleg", "Shadow Dancer (bootleg)", GAME_NOT_WORKING)
  11825. GAME( 1989, shdancrj, shdancer, shdancrj, shdancer, shdancrj, ROT0,         "Sega",    "Shadow Dancer (Japan)")
  11826. GAME( 1987, shinobi,  0,        shinobi,  shinobi,  shinobi,  ROT0,         "Sega",    "Shinobi (set 1)")
  11827. GAMEX(1987, shinobib, shinobi,  shinobi,  shinobi,  shinobi,  ROT0,         "Sega",    "Shinobi (set 3)", GAME_NOT_WORKING)
  11828. GAMEX(1987, shinobia, shinobi,  shinobl,  shinobi,  shinobi,  ROT0,         "Sega",    "Shinobi (set 2)", GAME_NOT_WORKING)
  11829. GAME( 1987, shinobl,  shinobi,  shinobl,  shinobi,  shinobi,  ROT0,         "bootleg", "Shinobi (bootleg)")
  11830. GAMEX(1988, tetris,   0,        tetris,   tetris,   tetris,   ROT0,         "Sega",    "Tetris (Sega Set 1)", GAME_NOT_WORKING)
  11831. GAME( 1988, tetrisbl, tetris,   tetris,   tetris,   tetrisbl, ROT0,         "bootleg", "Tetris (Sega bootleg)")
  11832. GAMEX(1988, tetrisa,  tetris,   tetris,   tetris,   tetrisbl, ROT0,         "Sega",    "Tetris (Sega Set 2)", GAME_NOT_WORKING)
  11833. GAME( 1987, timscanr, 0,        timscanr, timscanr, timscanr, ROT270,       "Sega",    "Time Scanner")
  11834. GAME (1994, toryumon, 0,        toryumon, toryumon, toryumon, ROT0,         "Sega",    "Toryumon")
  11835. GAMEX(1989, tturf,    0,        tturf,    tturf,    tturf,    ROT0_16BIT,   "Sega / Sunsoft", "Tough Turf (Japan)", GAME_NO_SOUND)
  11836. GAMEX(1989, tturfu,   tturf,    tturfu,   tturf,    tturf,    ROT0_16BIT,   "Sega / Sunsoft", "Tough Turf (US)", GAME_NO_SOUND)
  11837. GAMEX(1989, tturfbl,  tturf,    tturfbl,  tturf,    tturfbl,  ROT0_16BIT,   "bootleg", "Tough Turf (bootleg)", GAME_IMPERFECT_SOUND)
  11838. GAME( 1988, wb3,      0,        wb3,      wb3,      wb3,      ROT0,         "Sega / Westone", "Wonder Boy III - Monster Lair (set 1)")
  11839. GAMEX(1988, wb3a,     wb3,      wb3,      wb3,      wb3,      ROT0,         "Sega / Westone", "Wonder Boy III - Monster Lair (set 2)", GAME_NOT_WORKING)
  11840. GAME( 1988, wb3bl,    wb3,      wb3bl,    wb3,      wb3bl,    ROT0,         "bootleg", "Wonder Boy III - Monster Lair (bootleg)")
  11841. GAME( 1989, wrestwar, 0,        wrestwar, wrestwar, wrestwar, ROT270_16BIT, "Sega",    "Wrestle War")
  11842.  
  11843. GAME( 1985, hangon,   0,        hangon,   hangon,   hangon,   ROT0,         "Sega",    "Hang-On")
  11844. GAME( 1985, sharrier, 0,        sharrier, sharrier, sharrier, ROT0_16BIT,   "Sega",    "Space Harrier")
  11845. GAMEX(1992, shangon,  0,        shangon,  shangon,  shangon,  ROT0,         "Sega",    "Super Hang-On", GAME_NOT_WORKING)
  11846. GAME( 1992, shangonb, shangon,  shangon,  shangon,  shangonb, ROT0,         "bootleg", "Super Hang-On (bootleg)")
  11847. GAME( 1986, outrun,   0,        outrun,   outrun,   outrun,   ROT0,         "Sega",    "Out Run (set 1)")
  11848. GAME( 1986, outruna,  outrun,   outruna,  outrun,   outrun,   ROT0,         "Sega",    "Out Run (set 2)")
  11849. GAME( 1986, outrunb,  outrun,   outruna,  outrun,   outrunb,  ROT0,         "Sega",    "Out Run (set 3)")
  11850. GAMEX(1985, enduror,  0,        enduror,  enduror,  enduror,  ROT0,         "Sega",    "Enduro Racer", GAME_NOT_WORKING)
  11851. GAME( 1985, endurobl, enduror,  enduror,  enduror,  endurobl, ROT0,         "bootleg", "Enduro Racer (bootleg set 1)")
  11852. GAME( 1985, endurob2, enduror,  endurob2, enduror,  endurob2, ROT0,         "bootleg", "Enduro Racer (bootleg set 2)")
  11853.  
  11854.  
  11855.  
  11856. GAMEX(????, aceattac, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Ace Attacker", GAME_NOT_WORKING)
  11857. GAMEX(????, aburner,  0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "After Burner (Japan)", GAME_NOT_WORKING)
  11858. GAMEX(????, aburner2, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "After Burner II", GAME_NOT_WORKING)
  11859. GAMEX(????, bloxeed,  0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Bloxeed", GAME_NOT_WORKING)
  11860. GAMEX(????, cltchitr, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Clutch Hitter", GAME_NOT_WORKING)
  11861. GAMEX(????, cotton,   0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Cotton (Japan)", GAME_NOT_WORKING)
  11862. GAMEX(????, cottona,  cotton,   s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Cotton", GAME_NOT_WORKING)
  11863. GAMEX(????, ddcrew,   0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "DD Crew", GAME_NOT_WORKING)
  11864. GAMEX(????, dunkshot, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Dunk Shot", GAME_NOT_WORKING)
  11865. GAMEX(????, lghost,   0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Laser Ghost", GAME_NOT_WORKING)
  11866. GAMEX(????, loffire,  0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Line of Fire", GAME_NOT_WORKING)
  11867. GAMEX(????, mvp,      0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "MVP", GAME_NOT_WORKING)
  11868. GAMEX(????, thndrbld, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Thunder Blade", GAME_NOT_WORKING)
  11869. GAMEX(????, thndrbdj, thndrbld, s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Thunder Blade (Japan)", GAME_NOT_WORKING)
  11870. GAMEX(????, toutrun,  0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Turbo Outrun (set 1)", GAME_NOT_WORKING)
  11871. GAMEX(????, toutruna, toutrun,  s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Turbo Outrun (set 2)", GAME_NOT_WORKING)
  11872. GAMEX(????, exctleag, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Excite League", GAME_NOT_WORKING)
  11873. GAMEX(????, suprleag, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Super League", GAME_NOT_WORKING)
  11874. GAMEX(????, afighter, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Action Fighter", GAME_NOT_WORKING)
  11875. GAMEX(????, ryukyu  , 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Ryukyu", GAME_NOT_WORKING)
  11876.  
  11877.  
  11878.